X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;f=utils%2Fmkyaffs.c;h=a3ec11d2a46ef9d1dcf1080dd442739a7799ccdd;hb=ce5e10874d3f7ef75757bb48bbf7181d63f2ef2c;hp=fdcf4517f29453636a77de140dea978d4b4e74e2;hpb=37122d7644239983d55096a85bca6fb8e248cf20;p=yaffs%2F.git diff --git a/utils/mkyaffs.c b/utils/mkyaffs.c index fdcf451..a3ec11d 100644 --- a/utils/mkyaffs.c +++ b/utils/mkyaffs.c @@ -34,7 +34,7 @@ #include #include -const char *mkyaffs_c_version = "$Id: mkyaffs.c,v 1.7 2003-03-12 19:32:41 charles Exp $"; +const char *mkyaffs_c_version = "$Id: mkyaffs.c,v 1.8 2003-03-12 19:54:07 charles Exp $"; // countBits is a quick way of counting the number of bits in a byte. // ie. countBits[n] holds the number of 1 bits in a byte with the value n. @@ -111,8 +111,10 @@ int main(int argc, char **argv) usemtdecc = 1; } + printf("argc %d sh %d optcnt %d\n",argc, showHelp, optcnt); + /* Make sure a device was specified */ - if(showHelp || argc < (optcnt + 2)) { + if(showHelp || argc < (optcnt + 1)) { printf("usage: %s [-e] [image name]\n", argv[0]); printf(" -e Use mtd ecc. Default: do not use mtd ecc\n"); printf(" mtdname Name of mtd device\n"); @@ -123,7 +125,8 @@ int main(int argc, char **argv) exit(1); } - if((img = open(argv[optcnt + 1],O_RDONLY)) == -1) { + if( argc > (optcnt + 1) && + (img = open(argv[optcnt + 1],O_RDONLY)) == -1) { perror("opening image file"); exit(1); }