public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Small patch
@ 2001-03-09 16:54 Kári Davíðsson
  2001-03-09 19:36 ` Russ Dill
  2001-03-11 11:45 ` David Woodhouse
  0 siblings, 2 replies; 3+ messages in thread
From: Kári Davíðsson @ 2001-03-09 16:54 UTC (permalink / raw)
  To: mtd

[-- Attachment #1: Type: text/plain, Size: 171 bytes --]

Hi,

I propose the following small patch so that the utils can acept arguments
int hexadecimal form, e.g. 
	erase device 0x1f0000
instead of erase device 2031616.

K.D.



[-- Attachment #2: atoi.diff --]
[-- Type: text/plain, Size: 1930 bytes --]

diff -ubr mtd/util/erase.c mtd-20010308/util/erase.c
--- mtd/util/erase.c	Thu Sep 21 22:00:07 2000
+++ mtd-20010308/util/erase.c	Fri Mar  9 16:38:55 2001
@@ -35,12 +35,12 @@
       printf("Erase Unit Size 0x%lx, ", meminfo.erasesize);
 
       if (argc > 2)
-	  erase.start = atoi(argv[2]);
+	  erase.start = strtol(argv[2], NULL, 0);
       else
 	  erase.start = 0;
 
       if (argc > 3)
-	  count = atoi(argv[3]);
+	  count = strtol(argv[3], NULL, 0);
       else
 	  count = 1;
 
diff -ubr mtd/util/mkfs.ffs2.c mtd-20010308/util/mkfs.ffs2.c
--- mtd/util/mkfs.ffs2.c	Tue Aug 17 19:04:42 1999
+++ mtd-20010308/util/mkfs.ffs2.c	Fri Mar  9 16:43:05 2001
@@ -65,11 +65,11 @@
       switch (Opt)
       {
 	 case 'b':
-	 BlockSize = atoi(optarg);
+	 BlockSize = strtol(optarg, NULL, 0);
 	 break;
 	 
 	 case 's':
-	 Start = atoi(optarg);
+	 Start = strtol(optarg,NULL,0);
 	 break;
 
 	 case '?':
diff -ubr mtd/util/mkfs.jffs.c mtd-20010308/util/mkfs.jffs.c
--- mtd/util/mkfs.jffs.c	Wed Jan 17 23:00:03 2001
+++ mtd-20010308/util/mkfs.jffs.c	Fri Mar  9 16:44:20 2001
@@ -698,7 +698,7 @@
       }
       break;
     case 'e':
-      MAX_CHUNK_SIZE = (atoi(optarg) / 2);
+      MAX_CHUNK_SIZE = (strtol(optarg,NULL,0) / 2);
       break;
     case 'h':
     case '?':
diff -ubr mtd/util/mkfs.jffs2.c mtd-20010308/util/mkfs.jffs2.c
--- mtd/util/mkfs.jffs2.c	Mon Feb 26 23:00:06 2001
+++ mtd-20010308/util/mkfs.jffs2.c	Fri Mar  9 16:43:52 2001
@@ -430,7 +430,7 @@
 	while ( (opt = getopt_long(argc, argv, "p:d:r:s:e:o:h?", long_options, &c) ) >= 0) {
 		switch(opt) {
 		case 'p':
-			pad_fs_size = atoi(optarg);
+			pad_fs_size = strtol(optarg, NULL, 0);
 			break;
 
 		case 'r':
@@ -447,11 +447,11 @@
 			break;
 
 		case 's':
-			page_size = atoi(optarg);
+			page_size = strtol(optarg,NULL,0);
 			break;
 
 		case 'e':
-			erase_block_size = atoi(optarg);
+			erase_block_size = strtol(optarg,NULL,0);
 			break;
 
 		case 'o':

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-03-11 11:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-03-09 16:54 Small patch Kári Davíðsson
2001-03-09 19:36 ` Russ Dill
2001-03-11 11:45 ` David Woodhouse

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox