*** empty log message ***
authorcharles <charles>
Wed, 12 Mar 2003 19:54:07 +0000 (19:54 +0000)
committercharles <charles>
Wed, 12 Mar 2003 19:54:07 +0000 (19:54 +0000)
utils/mkyaffs.c

index fdcf4517f29453636a77de140dea978d4b4e74e2..a3ec11d2a46ef9d1dcf1080dd442739a7799ccdd 100644 (file)
@@ -34,7 +34,7 @@
 #include <linux/config.h>
 #include <linux/mtd/mtd.h>
 
-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] <mtdname> [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);
        }