From 638b02c2e2804a974009f580e3c4aed4801032e1 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 6 Mar 2016 06:39:27 -0500 Subject: argv.h: usage screen generator: give priority over . --- src/internal/argv/argv.h | 28 ++++++++++++++-------------- 1 file 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(""); @@ -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; -- cgit v1.2.3