]> granicus.if.org Git - apache/commitdiff
better readability, native newlines, less spam
authorAndré Malo <nd@apache.org>
Sat, 6 Nov 2004 21:38:24 +0000 (21:38 +0000)
committerAndré Malo <nd@apache.org>
Sat, 6 Nov 2004 21:38:24 +0000 (21:38 +0000)
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@105708 13f79535-47bb-0310-9956-ffa450edef68

support/htcacheclean.c

index 11db63dd8663f47dbd5baf83d4db4a75810b5a5e..db00c326b18ee587135e89bad53a4e63cfc658c8 100644 (file)
@@ -17,7 +17,7 @@
  * htcacheclean.c: simple program for cleaning of
  * the disk cache of the Apache HTTP server
  *
- * Contributed by Andreas Steinmetz <ast@domdv.de>
+ * Contributed by Andreas Steinmetz <ast domdv.de>
  * 8 Oct 2004
  */
 
@@ -148,6 +148,8 @@ static apr_off_t unsolicited; /* file size summary for deleted unsolicited
                                  files */
 static APR_RING_ENTRY(_entry) root; /* ENTRY ring anchor */
 
+/* short program name as called */
+static const char *shortname = "htcacheclean";
 
 #ifdef DEBUG
 /*
@@ -683,46 +685,44 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max)
 /*
  * usage info
  */
+#define NL APR_EOL_STR
 static void usage(void)
 {
-    apr_file_printf(errfile, "htcacheclean -- program for cleaning the "
-                             "disk cache.\n");
-    apr_file_printf(errfile, "Usage: htcacheclean [-Dvrn] -pPATH -lLIMIT\n");
-    apr_file_printf(errfile, "       htcacheclean [-Dvrn] -pPATH -LLIMIT\n");
-    apr_file_printf(errfile, "       htcacheclean [-ni] -dINTERVAL -pPATH "
-                             "-lLIMIT\n");
-    apr_file_printf(errfile, "       htcacheclean [-ni] -dINTERVAL -pPATH "
-                             "-LLIMIT\n");
-    apr_file_printf(errfile, "Options:\n");
-    apr_file_printf(errfile, "   -d   Daemonize and repeat cache cleaning "
-                             "every INTERVAL minutes. This\n"
-                             "        option is mutually exclusive with "
-                             "the -D, -v and -r options.\n");
-    apr_file_printf(errfile, "   -D   Do a dry run and don't delete anything. "
-                             "This option is mutually\n"
-                             "        exclusive with the -d option.\n");
-    apr_file_printf(errfile, "   -v   Be verbose and print statistics. "
-                             "This option is mutually exclusive\n"
-                             "        with the -d option.\n");
-    apr_file_printf(errfile, "   -r   Clean thoroughly. This assumes that "
-                             "the Apache web server\n"
-                             "        is not running. This option is "
-                             "mutually exclusive with the -d option.\n");
-    apr_file_printf(errfile, "   -n   Be nice. This causes slower processing "
-                             "in favour of other processes.\n");
-    apr_file_printf(errfile, "   -p   Specify PATH as the root directory of "
-                             "the disk cache.\n");
-    apr_file_printf(errfile, "   -l   Specify LIMIT as the total disk cache "
-                             "size limit in KBytes.\n");
-    apr_file_printf(errfile, "   -L   Specify LIMIT as the total disk cache "
-                             "size limit in MBytes.\n");
-    apr_file_printf(errfile, "   -i   Be intelligent and run only when there "
-                             "was a modification\n"
-                             "        of the disk cache. This option is only "
-                             "possible together with\n"
-                             "        the -d option.\n");
+    apr_file_printf(errfile,
+    "%s -- program for cleaning the disk cache."                             NL
+    "Usage: %s [-Dvrn] -pPATH -lLIMIT"                                       NL
+    "       %s [-Dvrn] -pPATH -LLIMIT"                                       NL
+    "       %s [-ni] -dINTERVAL -pPATH -lLIMIT"                              NL
+    "       %s [-ni] -dINTERVAL -pPATH -LLIMIT"                              NL
+    "Options:"                                                               NL
+    "  -d   Daemonize and repeat cache cleaning every INTERVAL minutes."     NL
+    "       This option is mutually exclusive with the -D, -v and -r"        NL
+    "       options."                                                        NL
+    "  -D   Do a dry run and don't delete anything. This option is mutually" NL
+    "       exclusive with the -d option."                                   NL
+    "  -v   Be verbose and print statistics. This option is mutually"        NL
+    "       exclusive with the -d option."                                   NL
+    "  -r   Clean thoroughly. This assumes that the Apache web server is "   NL
+    "       not running. This option is mutually exclusive with the -d"      NL
+    "       option."                                                         NL
+    "  -n   Be nice. This causes slower processing in favour of other"       NL
+    "       processes."                                                      NL
+    "  -p   Specify PATH as the root directory of the disk cache."           NL
+    "  -l   Specify LIMIT as the total disk cache size limit in KBytes."     NL
+    "  -L   Specify LIMIT as the total disk cache size limit in MBytes."     NL
+    "  -i   Be intelligent and run only when there was a modification of"    NL
+    "       the disk cache. This option is only possible together with the"  NL
+    "       -d option."                                                      NL,
+    shortname,
+    shortname,
+    shortname,
+    shortname,
+    shortname
+    );
+
     exit(1);
 }
+#undef NL
 
 /*
  * main
@@ -758,6 +758,10 @@ int main(int argc, const char * const argv[])
     }
     atexit(apr_terminate);
 
+    if (argc) {
+        shortname = apr_filepath_name_get(argv[0]);
+    }
+
     if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
         return 1;
     }