mirror of
https://github.com/apache/httpd.git
synced 2025-08-13 14:40:20 +00:00
simplify reporting of the repeated argument error
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@815448 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
@ -750,6 +750,12 @@ static void usage(const char *error)
|
|||||||
}
|
}
|
||||||
#undef NL
|
#undef NL
|
||||||
|
|
||||||
|
static void usage_repeated_arg(apr_pool_t *pool, char option) {
|
||||||
|
usage(apr_psprintf(pool,
|
||||||
|
"The option '%c' cannot be specified more than once",
|
||||||
|
option));
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* main
|
* main
|
||||||
*/
|
*/
|
||||||
@ -812,42 +818,42 @@ int main(int argc, const char * const argv[])
|
|||||||
switch (opt) {
|
switch (opt) {
|
||||||
case 'i':
|
case 'i':
|
||||||
if (intelligent) {
|
if (intelligent) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
intelligent = 1;
|
intelligent = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'D':
|
case 'D':
|
||||||
if (dryrun) {
|
if (dryrun) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
dryrun = 1;
|
dryrun = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
if (benice) {
|
if (benice) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
benice = 1;
|
benice = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
if (deldirs) {
|
if (deldirs) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
deldirs = 1;
|
deldirs = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
if (verbose) {
|
if (verbose) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
verbose = 1;
|
verbose = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
if (realclean) {
|
if (realclean) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
realclean = 1;
|
realclean = 1;
|
||||||
deldirs = 1;
|
deldirs = 1;
|
||||||
@ -855,7 +861,7 @@ int main(int argc, const char * const argv[])
|
|||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
if (isdaemon) {
|
if (isdaemon) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
isdaemon = 1;
|
isdaemon = 1;
|
||||||
repeat = apr_atoi64(arg);
|
repeat = apr_atoi64(arg);
|
||||||
@ -865,7 +871,7 @@ int main(int argc, const char * const argv[])
|
|||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
if (limit_found) {
|
if (limit_found) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
limit_found = 1;
|
limit_found = 1;
|
||||||
|
|
||||||
@ -898,7 +904,7 @@ int main(int argc, const char * const argv[])
|
|||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (proxypath) {
|
if (proxypath) {
|
||||||
usage(apr_psprintf(pool, "The option '%c' cannot be specified more than once", (int)opt));
|
usage_repeated_arg(pool, opt);
|
||||||
}
|
}
|
||||||
proxypath = apr_pstrdup(pool, arg);
|
proxypath = apr_pstrdup(pool, arg);
|
||||||
if ((status = apr_filepath_set(proxypath, pool)) != APR_SUCCESS) {
|
if ((status = apr_filepath_set(proxypath, pool)) != APR_SUCCESS) {
|
||||||
|
Reference in New Issue
Block a user