From 159807e2faa50a2940f09d57dfa6132220508cce Mon Sep 17 00:00:00 2001 From: Juan Castillo Date: Tue, 15 Dec 2015 16:37:57 +0000 Subject: 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 --- tools/cert_create/src/ext.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'tools/cert_create/src/ext.c') diff --git a/tools/cert_create/src/ext.c b/tools/cert_create/src/ext.c index 14aef661..3f56edb7 100644 --- a/tools/cert_create/src/ext.c +++ b/tools/cert_create/src/ext.c @@ -69,6 +69,7 @@ IMPLEMENT_ASN1_FUNCTIONS(HASH) */ int ext_init(void) { + cmd_opt_t cmd_opt; ext_t *ext; X509V3_EXT_METHOD *m; int nid, ret; @@ -78,10 +79,12 @@ int ext_init(void) ext = &extensions[i]; /* Register command line option */ if (ext->opt) { - if (cmd_opt_add(ext->opt, required_argument, - CMD_OPT_EXT)) { - return 1; - } + cmd_opt.long_opt.name = ext->opt; + cmd_opt.long_opt.has_arg = required_argument; + cmd_opt.long_opt.flag = NULL; + cmd_opt.long_opt.val = CMD_OPT_EXT; + cmd_opt.help_msg = ext->help_msg; + cmd_opt_add(&cmd_opt); } /* Register the extension OID in OpenSSL */ if (ext->oid == NULL) { -- cgit