Small patch
Kári Davíðsson
kd at flaga.is
Fri Mar 9 11:54:23 EST 2001
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.
-------------- next part --------------
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':
More information about the linux-mtd
mailing list