From 2724e648ea75872c7638f52420679b2d3682ebb4 Mon Sep 17 00:00:00 2001 From: charles Date: Wed, 12 Mar 2003 19:54:07 +0000 Subject: [PATCH 1/1] *** empty log message *** --- utils/mkyaffs.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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); } -- 2.30.2