diff options
author | Juan Castillo <juan.castillo@arm.com> | 2015-12-15 16:37:57 +0000 |
---|---|---|
committer | Juan Castillo <juan.castillo@arm.com> | 2016-01-07 14:48:27 +0000 |
commit | 159807e2faa50a2940f09d57dfa6132220508cce (patch) | |
tree | 4df4188a2552c735d205d79d09ed258ae568b5d8 /tools/cert_create/src/cert.c | |
parent | d0c104e1e1ad0102f0f4c70997b7ee6e6fbbe273 (diff) |
cert_create: update help message
The help message printed by the cert_create tool using the command
line option -h (or --help) does not correctly list all the available
command line options.
This patch reworks the print_help() function to print the help
messages in a data driven approach. For each command line option
registered, an optional help message can be specified, which will
be printed by print_help().
Help messages for the TBBR options (certificates, keys and images)
are also provided.
Fix a small bug in the short options string passed to getopt_long:
the ':' was missing in the '-a' option (this option must take an
argument).
Fixes ARM-software/tf-issues#337
Change-Id: I9d08c2dfd349022808fcc884724f677eefdc1452
Diffstat (limited to 'tools/cert_create/src/cert.c')
-rw-r--r-- | tools/cert_create/src/cert.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/tools/cert_create/src/cert.c b/tools/cert_create/src/cert.c index bf526451..a559832e 100644 --- a/tools/cert_create/src/cert.c +++ b/tools/cert_create/src/cert.c @@ -183,19 +183,21 @@ int cert_new(cert_t *cert, int days, int ca, STACK_OF(X509_EXTENSION) * sk) int cert_init(void) { + cmd_opt_t cmd_opt; cert_t *cert; - int rc = 0; unsigned int i; for (i = 0; i < num_certs; i++) { cert = &certs[i]; - rc = cmd_opt_add(cert->opt, required_argument, CMD_OPT_CERT); - if (rc != 0) { - break; - } + cmd_opt.long_opt.name = cert->opt; + cmd_opt.long_opt.has_arg = required_argument; + cmd_opt.long_opt.flag = NULL; + cmd_opt.long_opt.val = CMD_OPT_CERT; + cmd_opt.help_msg = cert->help_msg; + cmd_opt_add(&cmd_opt); } - return rc; + return 0; } cert_t *cert_get_by_opt(const char *opt) |