summaryrefslogtreecommitdiffstats
path: root/cli_classic.c
diff options
context:
space:
mode:
authorUwe Hermann <uwe@hermann-uwe.de>2010-06-04 17:07:39 +0000
committerUwe Hermann <uwe@hermann-uwe.de>2010-06-04 17:07:39 +0000
commit4862a4b903fe1dd9fd7d5b1e3bf35b3b691117f3 (patch)
treea31d78c669174f7448be25777457c5f56f492679 /cli_classic.c
parent9fec30ef399d8514cbf23fcb8d1ca067b1035b8d (diff)
downloadflashrom-4862a4b903fe1dd9fd7d5b1e3bf35b3b691117f3.zip
flashrom-4862a4b903fe1dd9fd7d5b1e3bf35b3b691117f3.tar.gz
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>
Diffstat (limited to 'cli_classic.c')
-rw-r--r--cli_classic.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/cli_classic.c b/cli_classic.c
index 4899b3a..791d836 100644
--- a/cli_classic.c
+++ b/cli_classic.c
@@ -38,14 +38,13 @@ void cli_classic_usage(const char *name)
int remaining = 0;
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
"-z|"
#endif
"-E|-r <file>|-w <file>|-v <file>]\n"
" [-c <chipname>] [-m [<vendor>:]<part>] [-l <file>]\n"
- " [-i <image>] [-p <programmername>[:<parameters>]]\n",
- name);
+ " [-i <image>] [-p <programmername>[:<parameters>]]\n\n");
printf("Please note that the command line interface for flashrom has "
"changed between\n"
@@ -119,9 +118,9 @@ void cli_classic_usage(const char *name)
"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);
}
@@ -185,7 +184,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
"specified. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
filename = strdup(optarg);
read_it = 1;
@@ -194,7 +193,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
"specified. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
filename = strdup(optarg);
write_it = 1;
@@ -204,12 +203,12 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
"specified. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
if (dont_verify_it) {
fprintf(stderr, "--verify and --noverify are"
"mutually exclusive. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
filename = strdup(optarg);
verify_it = 1;
@@ -218,7 +217,7 @@ int cli_classic(int argc, char *argv[])
if (verify_it) {
fprintf(stderr, "--verify and --noverify are"
"mutually exclusive. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
dont_verify_it = 1;
break;
@@ -232,7 +231,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
"specified. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
erase_it = 1;
break;
@@ -244,7 +243,7 @@ int cli_classic(int argc, char *argv[])
fprintf(stderr, "Error: Internal programmer support "
"was not compiled in and --mainboard only\n"
"applies to the internal programmer. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
#endif
break;
case 'f':
@@ -253,7 +252,7 @@ int cli_classic(int argc, char *argv[])
case 'l':
tempstr = strdup(optarg);
if (read_romlayout(tempstr))
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
break;
case 'i':
tempstr = strdup(optarg);
@@ -263,7 +262,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
"specified. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
list_supported = 1;
break;
@@ -272,13 +271,13 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
"specified. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
list_supported_wiki = 1;
#else
fprintf(stderr, "Error: Wiki output was not compiled "
"in. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
#endif
break;
case 'p':
@@ -310,7 +309,7 @@ int cli_classic(int argc, char *argv[])
if (programmer == PROGRAMMER_INVALID) {
fprintf(stderr, "Error: Unknown programmer "
"%s.\n", optarg);
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
break;
case 'R':
@@ -318,7 +317,7 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
"specified. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
exit(0);
break;
@@ -326,13 +325,13 @@ int cli_classic(int argc, char *argv[])
if (++operation_specified > 1) {
fprintf(stderr, "More than one operation "
"specified. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
cli_classic_usage(argv[0]);
exit(0);
break;
default:
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
break;
}
}
@@ -353,14 +352,14 @@ int cli_classic(int argc, char *argv[])
if (optind < argc) {
fprintf(stderr, "Error: Extra parameter found.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
#if CONFIG_INTERNAL == 1
if ((programmer != PROGRAMMER_INTERNAL) && (lb_part || lb_vendor)) {
fprintf(stderr, "Error: --mainboard requires the internal "
"programmer. Aborting.\n");
- cli_classic_abort_usage(argv[0]);
+ cli_classic_abort_usage();
}
#endif
OpenPOWER on IntegriCloud