1
0
mirror of https://review.coreboot.org/flashrom.git synced 2025-04-27 23:22:37 +02:00

Make the 'flashrom --help' output look a bit nicer

Only print "flashrom" as the program name unconditionally, not the full path
and program name (e.g. "/home/foo/bar/baz/flashrom" or on Windows
"C:\Foo\Bar\Whatever\flashrom.exe"). The path or exact executable name is
not really useful to print here, if you managed to run --help you already
know it, and it just makes the output look ugly.

Also, add a missing newline to make the output look nicer.

Finally, revert the "CONFIG_PRINT_WIKI ?= yes" change which accidentally
slipped into r1029.

Corresponding to flashrom svn r1030.

Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de>
Acked-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
This commit is contained in:
Uwe Hermann 2010-06-04 17:07:39 +00:00
parent 8b83f55979
commit 2db77a03ef
2 changed files with 22 additions and 23 deletions

View File

@ -120,7 +120,7 @@ CONFIG_BUSPIRATE_SPI ?= yes
CONFIG_DEDIPROG ?= no CONFIG_DEDIPROG ?= no
# Disable wiki printing by default. It is only useful if you have wiki access. # Disable wiki printing by default. It is only useful if you have wiki access.
CONFIG_PRINT_WIKI ?= yes CONFIG_PRINT_WIKI ?= no
ifeq ($(CONFIG_INTERNAL), yes) ifeq ($(CONFIG_INTERNAL), yes)
FEATURE_CFLAGS += -D'CONFIG_INTERNAL=1' FEATURE_CFLAGS += -D'CONFIG_INTERNAL=1'

View File

@ -38,14 +38,13 @@ void cli_classic_usage(const char *name)
int remaining = 0; int remaining = 0;
enum programmer p; enum programmer p;
printf("Usage: %s [-n] [-V] [-f] [-h|-R|-L|" printf("Usage: flashrom [-n] [-V] [-f] [-h|-R|-L|"
#if CONFIG_PRINT_WIKI == 1 #if CONFIG_PRINT_WIKI == 1
"-z|" "-z|"
#endif #endif
"-E|-r <file>|-w <file>|-v <file>]\n" "-E|-r <file>|-w <file>|-v <file>]\n"
" [-c <chipname>] [-m [<vendor>:]<part>] [-l <file>]\n" " [-c <chipname>] [-m [<vendor>:]<part>] [-l <file>]\n"
" [-i <image>] [-p <programmername>[:<parameters>]]\n", " [-i <image>] [-p <programmername>[:<parameters>]]\n\n");
name);
printf("Please note that the command line interface for flashrom has " printf("Please note that the command line interface for flashrom has "
"changed between\n" "changed between\n"
@ -119,9 +118,9 @@ void cli_classic_usage(const char *name)
"flash chips.\n\n"); "flash chips.\n\n");
} }
void cli_classic_abort_usage(const char *name) void cli_classic_abort_usage(void)
{ {
printf("Please run \"%s --help\" for usage info.\n", name); printf("Please run \"flashrom --help\" for usage info.\n");
exit(1); exit(1);
} }
@ -185,7 +184,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) { if (++operation_specified > 1) {
fprintf(stderr, "More than one operation " fprintf(stderr, "More than one operation "
"specified. Aborting.\n"); "specified. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
filename = strdup(optarg); filename = strdup(optarg);
read_it = 1; read_it = 1;
@ -194,7 +193,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) { if (++operation_specified > 1) {
fprintf(stderr, "More than one operation " fprintf(stderr, "More than one operation "
"specified. Aborting.\n"); "specified. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
filename = strdup(optarg); filename = strdup(optarg);
write_it = 1; write_it = 1;
@ -204,12 +203,12 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) { if (++operation_specified > 1) {
fprintf(stderr, "More than one operation " fprintf(stderr, "More than one operation "
"specified. Aborting.\n"); "specified. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
if (dont_verify_it) { if (dont_verify_it) {
fprintf(stderr, "--verify and --noverify are" fprintf(stderr, "--verify and --noverify are"
"mutually exclusive. Aborting.\n"); "mutually exclusive. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
filename = strdup(optarg); filename = strdup(optarg);
verify_it = 1; verify_it = 1;
@ -218,7 +217,7 @@ int cli_classic(int argc, char *argv[])
if (verify_it) { if (verify_it) {
fprintf(stderr, "--verify and --noverify are" fprintf(stderr, "--verify and --noverify are"
"mutually exclusive. Aborting.\n"); "mutually exclusive. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
dont_verify_it = 1; dont_verify_it = 1;
break; break;
@ -232,7 +231,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) { if (++operation_specified > 1) {
fprintf(stderr, "More than one operation " fprintf(stderr, "More than one operation "
"specified. Aborting.\n"); "specified. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
erase_it = 1; erase_it = 1;
break; break;
@ -244,7 +243,7 @@ int cli_classic(int argc, char *argv[])
fprintf(stderr, "Error: Internal programmer support " fprintf(stderr, "Error: Internal programmer support "
"was not compiled in and --mainboard only\n" "was not compiled in and --mainboard only\n"
"applies to the internal programmer. Aborting.\n"); "applies to the internal programmer. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
#endif #endif
break; break;
case 'f': case 'f':
@ -253,7 +252,7 @@ int cli_classic(int argc, char *argv[])
case 'l': case 'l':
tempstr = strdup(optarg); tempstr = strdup(optarg);
if (read_romlayout(tempstr)) if (read_romlayout(tempstr))
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
break; break;
case 'i': case 'i':
tempstr = strdup(optarg); tempstr = strdup(optarg);
@ -263,7 +262,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) { if (++operation_specified > 1) {
fprintf(stderr, "More than one operation " fprintf(stderr, "More than one operation "
"specified. Aborting.\n"); "specified. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
list_supported = 1; list_supported = 1;
break; break;
@ -272,13 +271,13 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) { if (++operation_specified > 1) {
fprintf(stderr, "More than one operation " fprintf(stderr, "More than one operation "
"specified. Aborting.\n"); "specified. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
list_supported_wiki = 1; list_supported_wiki = 1;
#else #else
fprintf(stderr, "Error: Wiki output was not compiled " fprintf(stderr, "Error: Wiki output was not compiled "
"in. Aborting.\n"); "in. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
#endif #endif
break; break;
case 'p': case 'p':
@ -310,7 +309,7 @@ int cli_classic(int argc, char *argv[])
if (programmer == PROGRAMMER_INVALID) { if (programmer == PROGRAMMER_INVALID) {
fprintf(stderr, "Error: Unknown programmer " fprintf(stderr, "Error: Unknown programmer "
"%s.\n", optarg); "%s.\n", optarg);
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
break; break;
case 'R': case 'R':
@ -318,7 +317,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) { if (++operation_specified > 1) {
fprintf(stderr, "More than one operation " fprintf(stderr, "More than one operation "
"specified. Aborting.\n"); "specified. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
exit(0); exit(0);
break; break;
@ -326,13 +325,13 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) { if (++operation_specified > 1) {
fprintf(stderr, "More than one operation " fprintf(stderr, "More than one operation "
"specified. Aborting.\n"); "specified. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
cli_classic_usage(argv[0]); cli_classic_usage(argv[0]);
exit(0); exit(0);
break; break;
default: default:
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
break; break;
} }
} }
@ -353,14 +352,14 @@ int cli_classic(int argc, char *argv[])
if (optind < argc) { if (optind < argc) {
fprintf(stderr, "Error: Extra parameter found.\n"); fprintf(stderr, "Error: Extra parameter found.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
#if CONFIG_INTERNAL == 1 #if CONFIG_INTERNAL == 1
if ((programmer != PROGRAMMER_INTERNAL) && (lb_part || lb_vendor)) { if ((programmer != PROGRAMMER_INTERNAL) && (lb_part || lb_vendor)) {
fprintf(stderr, "Error: --mainboard requires the internal " fprintf(stderr, "Error: --mainboard requires the internal "
"programmer. Aborting.\n"); "programmer. Aborting.\n");
cli_classic_abort_usage(argv[0]); cli_classic_abort_usage();
} }
#endif #endif