mtd/util nanddump.c,1.15,1.16

gleixner at infradead.org gleixner at infradead.org
Sat Sep 11 13:15:07 EDT 2004


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

Modified Files:
	nanddump.c 
Log Message:
fix prettyprint in spite of its sillyness

Index: nanddump.c
===================================================================
RCS file: /home/cvs/mtd/util/nanddump.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- nanddump.c	11 Sep 2004 17:06:39 -0000	1.15
+++ nanddump.c	11 Sep 2004 17:15:05 -0000	1.16
@@ -49,7 +49,7 @@
 
 	/* Make sure enough arguments were passed */ 
 	if (argc < 3) {
-		fprintf(stdout, "nanddump V1.15");
+		fprintf(stdout, "nanddump V1.16");
 		fprintf(stderr, "usage: <mtdname> <dumpname> [start addr] [length]\n");
 		exit(1);
 	}
@@ -153,23 +153,27 @@
 
 		/* Write out OOB data */
 		if (pretty_print) {
-			if (meminfo.oobsize == 16) {
-				sprintf(pretty_buf, "  OOB Data: %02x %02x %02x %02x %02x %02x "
-					"%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
-					oobbuf[0], oobbuf[1], oobbuf[2],
-					oobbuf[3], oobbuf[4], oobbuf[5],
-					oobbuf[6], oobbuf[7], oobbuf[8],
-					oobbuf[9], oobbuf[10], oobbuf[11],
-					oobbuf[12], oobbuf[13], oobbuf[14],
-					oobbuf[15]);
-				write(ofd, pretty_buf, 60);
-			} else {
+
+			if (meminfo.oobsize < 16) {
 				sprintf(pretty_buf, "  OOB Data: %02x %02x %02x %02x %02x %02x "
 					"%02x %02x\n",
 					oobbuf[0], oobbuf[1], oobbuf[2],
 					oobbuf[3], oobbuf[4], oobbuf[5],
 					oobbuf[6], oobbuf[7]);
 				write(ofd, pretty_buf, 48);
+				continue;
+			}
+
+			for (i = 0; i < meminfo.oobsize; i += 16) {
+				sprintf(pretty_buf, "  OOB Data: %02x %02x %02x %02x %02x %02x "
+					"%02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
+					oobbuf[i], oobbuf[i+1], oobbuf[i+2],
+					oobbuf[i+3], oobbuf[i+4], oobbuf[i+5],
+					oobbuf[i+6], oobbuf[i+7], oobbuf[i+8],
+					oobbuf[i+9], oobbuf[i+10], oobbuf[i+11],
+					oobbuf[i+12], oobbuf[i+13], oobbuf[i+14],
+					oobbuf[i+15]);
+				write(ofd, pretty_buf, 60);
 			}
 		} else
 			write(ofd, oobbuf, meminfo.oobsize);





More information about the linux-mtd-cvs mailing list