Mercurial > hg > sidinfo
changeset 75:92a4065c41d0
Improve listing of available fields in --help.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Fri, 01 Jan 2016 04:27:07 +0200 |
parents | 5d61d8dbc77f |
children | ed63d30669f6 |
files | sidinfo.c |
diffstat | 1 files changed, 6 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/sidinfo.c Fri Jan 01 04:10:56 2016 +0200 +++ b/sidinfo.c Fri Jan 01 04:27:07 2016 +0200 @@ -125,7 +125,7 @@ void argShowHelp(void) { - int index, n; + int index, len; th_print_banner(stdout, th_prog_name, "[options] <sid filename> [sid filename #2 ..]"); th_args_help(stdout, optList, optListN, 0); @@ -133,15 +133,16 @@ "\n" "Available fields:\n"); - for (index = n = 0; index < noptPSFlags; index++) + for (len = index = 0; index < noptPSFlags; index++) { const PSFOption *opt = &optPSFlags[index]; - printf("%s%s", opt->name, (index < noptPSFlags - 1) ? ", " : "\n\n"); - if (++n > 5) + len += strlen(opt->name) + 3; + if (len >= 72) { printf("\n"); - n = 0; + len = 0; } + printf("%s%s", opt->name, (index < noptPSFlags - 1) ? ", " : "\n\n"); } printf(