From e8ba538d034fb50549bb838b6446d8c1fad8379f Mon Sep 17 00:00:00 2001 From: Uwe Hermann Date: Fri, 22 May 2009 11:37:27 +0000 Subject: A bunch of output beautifications and improvements, as well as doc fixes - Update manpage, we now report supported boards via -L. - Add some missing escaping for '-' characters in the manpage. Corresponding to flashrom svn r543. - Shorten some of the really long device names, so that -L output looks nicer. - Display a "table header" for all entries/columns in -L output. - Make -L output tabular for all lists for better readability. - Do not print "unknown XXXX SPI chip" entries in -L output. - And random other cosmetics... Signed-off-by: Uwe Hermann Acked-by: Uwe Hermann Acked-by: Patrick Georgi --- flashrom.c | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) (limited to 'flashrom.c') diff --git a/flashrom.c b/flashrom.c index e002ca2..c47c6fd 100644 --- a/flashrom.c +++ b/flashrom.c @@ -313,7 +313,7 @@ int erase_flash(struct flashchip *flash) void print_supported_chips(void) { - int okcol = 0, pos = 0; + int okcol = 0, pos = 0, i; struct flashchip *f; for (f = flashchips; f->name != NULL; f++) { @@ -323,7 +323,8 @@ void print_supported_chips(void) } okcol = (okcol + 7) & ~7; - POS_PRINT("Supported flash chips:"); + printf("Supported flash chips:\n\n"); + POS_PRINT("Vendor: Device:"); while (pos < okcol) { printf("\t"); pos += 8 - (pos % 8); @@ -331,8 +332,16 @@ void print_supported_chips(void) printf("Tested OK operations:\tKnown BAD operations:\n\n"); for (f = flashchips; f->name != NULL; f++) { - printf("%s %s", f->vendor, f->name); - pos = strlen(f->vendor) + 1 + strlen(f->name); + /* Don't print "unknown XXXX SPI chip" entries. */ + if (!strncmp(f->name, "unknown", 7)) + continue; + + printf("%s", f->vendor); + for (i = 0; i < 10 - strlen(f->vendor); i++) + printf(" "); + printf("%s", f->name); + + pos = 10 + strlen(f->name); while (pos < okcol) { printf("\t"); pos += 8 - (pos % 8); @@ -368,13 +377,13 @@ void print_supported_chips(void) void usage(const char *name) { printf("usage: %s [-EVfLhR] [-r file] [-w file] [-v file] [-c chipname] [-s addr]\n" - " [-e addr] [-m [vendor:]part] [-l file] [-i image] [-p programmer] [file]", + " [-e addr] [-m [vendor:]part] [-l file] [-i image] [-p programmer] [file]\n\n", name); - printf("\n\nPlease note that the command line interface for flashrom will " - "change before flashrom 1.0.\nDo not use flashrom in scripts or " - "other automated tools without checking that your flashrom\n" - "version won't interpret them in a totally different way.\n\n"); + printf("Please note that the command line interface for flashrom will " + "change before\nflashrom 1.0. Do not use flashrom in scripts " + "or other automated tools without\nchecking that your flashrom" + " version won't interpret options in a different way.\n\n"); printf (" -r | --read: read flash and save into file\n" @@ -387,7 +396,7 @@ void usage(const char *name) " -e | --eend : exclude end postion\n" " -m | --mainboard <[vendor:]part>: override mainboard settings\n" " -f | --force: force write without checking image\n" - " -l | --layout : read rom layout from file\n" + " -l | --layout : read ROM layout from file\n" " -i | --image : only flash image name from flash layout\n" " -L | --list-supported: print supported devices\n" " -p | --programmer : specify the programmer device\n" -- cgit v1.1