diff options
author | midipix <writeonce@midipix.org> | 2016-03-06 06:39:27 -0500 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-03-06 09:20:16 -0500 |
commit | 638b02c2e2804a974009f580e3c4aed4801032e1 (patch) | |
tree | 626eda0ba9d80c457211dc3afce51814bfade91c /src | |
parent | 4d825e8a11f4e5db80858ebd0efa1ceb67a00cb1 (diff) | |
download | apimagic-638b02c2e2804a974009f580e3c4aed4801032e1.tar.bz2 apimagic-638b02c2e2804a974009f580e3c4aed4801032e1.tar.xz |
argv.h: usage screen generator: give <argname> priority over <paradigm>.
Diffstat (limited to 'src')
-rw-r--r-- | src/internal/argv/argv.h | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/internal/argv/argv.h b/src/internal/argv/argv.h index c8554f9..718cf1b 100644 --- a/src/internal/argv/argv.h +++ b/src/internal/argv/argv.h @@ -780,10 +780,10 @@ static void argv_usage( if (len > optlen) optlen = len; - if (option->paradigm) - len = strlen(option->paradigm) + strlen("{}"); - else if (option->argname) + if (option->argname) len = strlen(option->argname); + else if (option->paradigm) + len = strlen(option->paradigm) + strlen("{}"); else if (option->optarg != ARGV_OPTARG_NONE) len = strlen("<val>"); @@ -899,7 +899,17 @@ static void argv_usage( } } - if (option->paradigm && (rparalen <= paralen)) { + if (option->argname) { + if (option->optarg == ARGV_OPTARG_OPTIONAL) + fprintf(file,"[%s]%-*c", + option->argname, + (int)(paralen-strlen(option->argname)-brcklen),' '); + else + fprintf(file,"%s%-*c", + option->argname, + (int)(paralen-strlen(option->argname)),' '); + para = (char *)0; + } else if (option->paradigm && (rparalen <= paralen)) { if (option->optarg == ARGV_OPTARG_OPTIONAL) fprintf(file,"[{%s}]%-*c", option->paradigm, @@ -923,16 +933,6 @@ static void argv_usage( fputc('{',file); rparalen = paralen - rblen; } - } else if (option->argname) { - if (option->optarg == ARGV_OPTARG_OPTIONAL) - fprintf(file,"[%s]%-*c", - option->argname, - (int)(paralen-strlen(option->argname)-brcklen),' '); - else - fprintf(file,"%s%-*c", - option->argname, - (int)(paralen-strlen(option->argname)),' '); - para = (char *)0; } else { fprintf(file,"%-*c",(int)paralen,' '); para = (char *)0; |