Skip to contentSkip to conversation

Small patch

PATCH Applied K�ri Dav��sson 3 participants 3 messages Mar 9, 2001 – Mar 11, 2001 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

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.

util/erase.c +2 -2
diff -ubr mtd/util/erase.c mtd-20010308/util/erase.c
@@ -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;
 
util/mkfs.ffs2.c +2 -2
diff -ubr mtd/util/mkfs.ffs2.c mtd-20010308/util/mkfs.ffs2.c
@@ -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 '?':
util/mkfs.jffs.c +1 -1
diff -ubr mtd/util/mkfs.jffs.c mtd-20010308/util/mkfs.jffs.c
@@ -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 '?':
util/mkfs.jffs2.c +3 -3
diff -ubr mtd/util/mkfs.jffs2.c mtd-20010308/util/mkfs.jffs2.c
@@ -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':
#1 lore raw
Quoted 4 lines

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.

smart move, david, please apply this when you get a chance

To unsubscribe, send "unsubscribe mtd" to [email protected]

#2 lore raw
In reply to K�ri Dav��sson
Quoted 4 lines · K�ri Dav��sson

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.

Applied, thanks.

Signature · 6 lines
dwmw2




To unsubscribe, send "unsubscribe mtd" to [email protected]