#include <stdlib.h>
#include <time.h>
#include <unistd.h>
+#include <string.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <asm/types.h>
-#include <linux/config.h>
-#include <linux/mtd/mtd.h>
+#include <mtd/mtd-user.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.9 2005-10-11 23:39:56 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.
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");
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);
}