diff options
author | David Shaw <[email protected]> | 2005-09-14 22:31:21 +0000 |
---|---|---|
committer | David Shaw <[email protected]> | 2005-09-14 22:31:21 +0000 |
commit | 4afa18bcaacb2d75dd1eb97830b9e8fb709d2104 (patch) | |
tree | 538df6c905749d6cc0d7515eada2175829fb08a0 /g10/misc.c | |
parent | * keyedit.c (show_names): Moved name display code out from (diff) | |
download | gnupg-4afa18bcaacb2d75dd1eb97830b9e8fb709d2104.tar.gz gnupg-4afa18bcaacb2d75dd1eb97830b9e8fb709d2104.zip |
* main.h, misc.c (parse_options): Add the ability to have help
strings in xxx-options commands.
* keyserver.c (keyserver_opts), import.c (parse_import_options),
export.c (parse_export_options), g10.c (parse_list_options, main):
Add help strings to xxx-options.
Diffstat (limited to 'g10/misc.c')
-rw-r--r-- | g10/misc.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/g10/misc.c b/g10/misc.c index 8d7b6804a..a50ab884e 100644 --- a/g10/misc.c +++ b/g10/misc.c @@ -968,11 +968,20 @@ parse_options(char *str,unsigned int *options, if (str && !strcmp (str, "help")) { - int i; + int i,maxlen=0; + + /* Figure out the longest option name so we can line these up + neatly. */ + for(i=0;opts[i].name;i++) + if(opts[i].help && maxlen<strlen(opts[i].name)) + maxlen=strlen(opts[i].name); for(i=0;opts[i].name;i++) - printf ("%s\n", opts[i].name); - g10_exit (0); + if(opts[i].help) + printf("%s%*s%s\n",opts[i].name, + maxlen+2-strlen(opts[i].name),"",_(opts[i].help)); + + g10_exit(0); } while((tok=optsep(&str))) |