diff options
author | Bill Richardson <wfrichar@chromium.org> | 2014-09-23 11:47:40 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-09-24 00:59:02 +0000 |
commit | 779796f57e1e0236ea502248ede2cbea986fca21 (patch) | |
tree | ccb33230dec19efa3d9e93888b875e70276f1db6 /futility/cmd_vbutil_firmware.c | |
parent | 0f07867e6fe186ea460afd557e830c1e49f1ff85 (diff) | |
download | vboot-779796f57e1e0236ea502248ede2cbea986fca21.tar.gz |
futility: Improve help messagesstabilize-6297.B
This provides help messages for the futility commands similar to
the way git does. These show the available commands:
futility
futility help
futility --help
While these show help for a specific command:
futility help COMMAND
futility --help COMMAND
futility COMMAND --help
BUG=none
BRANCH=ToT
TEST=manual
make runtests
And manually look at help messages for each command.
Change-Id: I1126471e242784c6ca7a2f11694fa7c505d833e8
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/219528
Reviewed-by: Randall Spangler <rspangler@chromium.org>
Diffstat (limited to 'futility/cmd_vbutil_firmware.c')
-rw-r--r-- | futility/cmd_vbutil_firmware.c | 65 |
1 files changed, 34 insertions, 31 deletions
diff --git a/futility/cmd_vbutil_firmware.c b/futility/cmd_vbutil_firmware.c index 95cae28d..dcb325e1 100644 --- a/futility/cmd_vbutil_firmware.c +++ b/futility/cmd_vbutil_firmware.c @@ -46,33 +46,32 @@ static const struct option long_opts[] = { }; /* Print help and return error */ -static int PrintHelp(void) +static void print_help(const char *prog) { - - puts("vbutil_firmware - Verified boot key block utility\n" - "\n" - "Usage: vbutil_firmware <--vblock|--verify> <file> [OPTIONS]\n" - "\n" - "For '--vblock <file>', required OPTIONS are:\n" - " --keyblock <file> Key block in .keyblock format\n" - " --signprivate <file>" - " Signing private key in .vbprivk format\n" - " --version <number> Firmware version\n" - " --fv <file> Firmware volume to sign\n" - " --kernelkey <file> Kernel subkey in .vbpubk format\n" - "optional OPTIONS are:\n" - " --flags <number> Preamble flags (defaults to 0)\n" - "\n" - "For '--verify <file>', required OPTIONS are:\n" - " --signpubkey <file>" - " Signing public key in .vbpubk format\n" - " --fv <file> Firmware volume to verify\n" - "\n" - "For '--verify <file>', optional OPTIONS are:\n" - " --kernelkey <file>" - " Write the kernel subkey to this file\n" - ""); - return 1; + printf("\nUsage: " MYNAME " %s <--vblock|--verify> <file> [OPTIONS]\n" + "\n" + "For '--vblock <file>', required OPTIONS are:\n" + "\n" + " --keyblock <file> Key block in .keyblock format\n" + " --signprivate <file>" + " Signing private key in .vbprivk format\n" + " --version <number> Firmware version\n" + " --fv <file> Firmware volume to sign\n" + " --kernelkey <file> Kernel subkey in .vbpubk format\n" + "\n" + "optional OPTIONS are:\n" + " --flags <number> Preamble flags (defaults to 0)\n" + "\n" + "For '--verify <file>', required OPTIONS are:\n" + "\n" + " --signpubkey <file>" + " Signing public key in .vbpubk format\n" + " --fv <file> Firmware volume to verify\n" + "\n" + "For '--verify <file>', optional OPTIONS are:\n" + " --kernelkey <file>" + " Write the kernel subkey to this file\n\n", + prog); } /* Create a firmware .vblock */ @@ -368,8 +367,10 @@ static int do_vbutil_firmware(int argc, char *argv[]) } } - if (parse_error) - return PrintHelp(); + if (parse_error) { + print_help(argv[0]); + return 1; + } switch (mode) { case OPT_MODE_VBLOCK: @@ -378,10 +379,12 @@ static int do_vbutil_firmware(int argc, char *argv[]) case OPT_MODE_VERIFY: return Verify(filename, signpubkey, fv_file, kernelkey_file); default: - printf("Must specify a mode.\n"); - return PrintHelp(); + fprintf(stderr, "Must specify a mode.\n"); + print_help(argv[0]); + return 1; } } DECLARE_FUTIL_COMMAND(vbutil_firmware, do_vbutil_firmware, - "Verified boot firmware utility"); + "Verified boot firmware utility", + print_help); |