mtd/util eraseall.c,1.10,1.11

David Woodhouse dwmw2 at infradead.org
Thu Apr 3 06:42:59 EST 2003


Update of /home/cvs/mtd/util
In directory phoenix.infradead.org:/tmp/cvs-serv9773

Modified Files:
	eraseall.c 
Log Message:
From: 	Stephane Fillod <f4cfe at free.fr>
* typo in eraseall.c, enable short option 'j', make cleanmarker to work:
  this was obviously NOT tested. Now, it's okay.


Index: eraseall.c
===================================================================
RCS file: /home/cvs/mtd/util/eraseall.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- eraseall.c	2 Apr 2003 17:00:51 -0000	1.10
+++ eraseall.c	3 Apr 2003 11:42:56 -0000	1.11
@@ -45,7 +45,7 @@
 #include "linux/jffs2.h"
 
 #define PROGRAM "eraseall"
-#define VERSION "0.1.1"
+#define VERSION "0.1.2"
 
 static const char *exe_name;
 static const char *mtd_device;
@@ -122,18 +122,20 @@
 				continue;
 			}
 		} else {
-			if (lseek (fd, erase.start, SEEK_SET) != 0) {
+			if (lseek (fd, erase.start, SEEK_SET) < 0) {
 				fprintf(stderr, "\n%s: %s: MTD lseek failure: %s\n", exe_name, mtd_device, strerror(errno));
 				continue;
 			}	
-			if (write (fd , &cleanmarker, sizeof (cleanmarker)) != 0) {
+			if (write (fd , &cleanmarker, sizeof (cleanmarker)) != sizeof (cleanmarker)) {
 				fprintf(stderr, "\n%s: %s: MTD write failure: %s\n", exe_name, mtd_device, strerror(errno));
 				continue;
 			}
 		}
 		if (!quiet)
-			printf ("\rCleanmarker written at %x\n", erase.start);
+			printf (" Cleanmarker written at %x.", erase.start);
 	}
+	if (!quiet)
+		printf("\n");
 
 	return 0;
 }
@@ -147,7 +149,7 @@
 
 	for (;;) {
 		int option_index = 0;
-		static const char *short_options = "q";
+		static const char *short_options = "jq";
 		static const struct option long_options[] = {
 			{"help", no_argument, 0, 0},
 			{"version", no_argument, 0, 0},
@@ -205,7 +207,7 @@
 	printf("Usage: %s [OPTION] MTD_DEVICE\n"
 	       "Erases all of the specified MTD device.\n"
 	       "\n"
-	       "  -j, --jffs2    format the device for jffs2"
+	       "  -j, --jffs2    format the device for jffs2\n"
 	       "  -q, --quiet    don't display progress messages\n"
 	       "      --silent   same as --quiet\n"
 	       "      --help     display this help and exit\n"




More information about the linux-mtd-cvs mailing list