httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject svn commit: r815448 - /httpd/httpd/trunk/support/htcacheclean.c
Date Tue, 15 Sep 2009 18:59:53 GMT
Author: trawick
Date: Tue Sep 15 18:59:52 2009
New Revision: 815448

URL: http://svn.apache.org/viewvc?rev=815448&view=rev
Log:
simplify reporting of the repeated argument error

Modified:
    httpd/httpd/trunk/support/htcacheclean.c

Modified: httpd/httpd/trunk/support/htcacheclean.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/support/htcacheclean.c?rev=815448&r1=815447&r2=815448&view=diff
==============================================================================
--- httpd/httpd/trunk/support/htcacheclean.c (original)
+++ httpd/httpd/trunk/support/htcacheclean.c Tue Sep 15 18:59:52 2009
@@ -750,6 +750,12 @@
 }
 #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
  */
@@ -812,42 +818,42 @@
             switch (opt) {
             case 'i':
                 if (intelligent) {
-                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
+                    usage_repeated_arg(pool, opt);
                 }
                 intelligent = 1;
                 break;
 
             case 'D':
                 if (dryrun) {
-                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
+                    usage_repeated_arg(pool, opt);
                 }
                 dryrun = 1;
                 break;
 
             case 'n':
                 if (benice) {
-                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
+                    usage_repeated_arg(pool, opt);
                 }
                 benice = 1;
                 break;
 
             case 't':
                 if (deldirs) {
-                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
+                    usage_repeated_arg(pool, opt);
                 }
                 deldirs = 1;
                 break;
 
             case 'v':
                 if (verbose) {
-                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
+                    usage_repeated_arg(pool, opt);
                 }
                 verbose = 1;
                 break;
 
             case 'r':
                 if (realclean) {
-                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
+                    usage_repeated_arg(pool, opt);
                 }
                 realclean = 1;
                 deldirs = 1;
@@ -855,7 +861,7 @@
 
             case 'd':
                 if (isdaemon) {
-                    usage(apr_psprintf(pool, "The option '%c' cannot be specified more than
once", (int)opt));
+                    usage_repeated_arg(pool, opt);
                 }
                 isdaemon = 1;
                 repeat = apr_atoi64(arg);
@@ -865,7 +871,7 @@
 
             case 'l':
                 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;
 
@@ -898,7 +904,7 @@
 
             case 'p':
                 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);
                 if ((status = apr_filepath_set(proxypath, pool)) != APR_SUCCESS) {



Mime
View raw message