summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2016-03-06 06:39:27 -0500
committermidipix <writeonce@midipix.org>2016-11-10 23:35:39 -0500
commit40e279fbebbe8aa1a18c2d498e635e364aeee37f (patch)
tree36647124218e55578c45189c9ca296a7704bbe90
parent0caedfea7f4a990e20b1667b12e461005958dcef (diff)
downloadperk-40e279fbebbe8aa1a18c2d498e635e364aeee37f.tar.bz2
perk-40e279fbebbe8aa1a18c2d498e635e364aeee37f.tar.xz
argv.h: usage screen generator: give <argname> priority over <paradigm>.
-rw-r--r--src/internal/argv/argv.h28
1 files changed, 14 insertions, 14 deletions
diff --git a/src/internal/argv/argv.h b/src/internal/argv/argv.h
index da5d115..4b9c13b 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;