# HG changeset patch # User Matti Hamalainen # Date 1451615227 -7200 # Node ID 92a4065c41d0ebd67ae82f89bcd6b8c5ffe680c2 # Parent 5d61d8dbc77f2ed13c7579520ca5a23149baab91 Improve listing of available fields in --help. diff -r 5d61d8dbc77f -r 92a4065c41d0 sidinfo.c --- 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 #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(