--------------------- PatchSet 6109 Date: 2007/11/11 23:24:40 Author: amosjeffries Branch: docs Tag: (none) Log: Document squid command line options. Members: src/main.cc:1.86.2.3->1.86.2.4 Index: squid3/src/main.cc =================================================================== RCS file: /cvsroot/squid-sf//squid3/src/main.cc,v retrieving revision 1.86.2.3 retrieving revision 1.86.2.4 diff -u -r1.86.2.3 -r1.86.2.4 --- squid3/src/main.cc 26 Sep 2007 03:35:48 -0000 1.86.2.3 +++ squid3/src/main.cc 11 Nov 2007 23:24:40 -0000 1.86.2.4 @@ -1,6 +1,5 @@ - /* - * $Id: main.cc,v 1.86.2.3 2007/09/26 03:35:48 amosjeffries Exp $ + * $Id: main.cc,v 1.86.2.4 2007/11/11 23:24:40 amosjeffries Exp $ * * DEBUG: section 1 Startup and Main Loop * AUTHOR: Harvest Derived @@ -87,7 +86,7 @@ #endif -/* for error reporting from xmalloc and friends */ +/** for error reporting from xmalloc and friends */ SQUIDCEXTERN void (*failure_notify) (const char *); static int opt_parse_cfg_only = 0; @@ -129,7 +128,7 @@ #include "test_access.c" #endif -/* temporary thunk across to the unrefactored store interface */ +/** temporary thunk across to the unrefactored store interface */ class StoreRootEngine : public AsyncEngine { @@ -240,6 +239,12 @@ exit(1); } +/** + * Parse the parameters received via command line interface. + * + \param argc[in] Number of options received on command line + \param argv[in] List of parameters received on command line + */ static void mainParseOptions(int argc, char *argv[]) { @@ -247,99 +252,114 @@ int c; #if USE_WIN32_SERVICE - while ((c = getopt(argc, argv, "CDFNO:RSVYXa:d:f:hik:m::n:rsl:u:vz?")) != -1) #else - while ((c = getopt(argc, argv, "CDFNRSYXa:d:f:hk:m::sl:u:vz?")) != -1) #endif - { switch (c) { case 'C': + /** \par C + * Unset/disabel global option for catchign signals. opt_catch_signals */ opt_catch_signals = 0; break; case 'D': + /** \par D + * Unset/disable global option for optional DNS tests. opt_dns_tests */ opt_dns_tests = 0; break; case 'F': + /** \par F + * Set global option for foreground rebuild. opt_foreground_rebuild */ opt_foreground_rebuild = 1; break; case 'N': + /** \par N + * Set global option for 'no_daemon' mode. opt_no_daemon */ opt_no_daemon = 1; break; + #if USE_WIN32_SERVICE case 'O': + /** \par O + * Set global option. opt_command_lin and WIN32_Command_Line */ opt_command_line = 1; WIN32_Command_Line = xstrdup(optarg); break; #endif case 'R': + /** \par R + * Unset/disable global option opt_reuseaddr */ opt_reuseaddr = 0; break; case 'S': + /** \par S + * Set global option opt_store_doublecheck */ opt_store_doublecheck = 1; break; case 'X': - /* force full debugging */ + /** \par X + * Force full debugging */ sigusr2_handle(SIGUSR2); - break; case 'Y': + /** \par Y + * Set global option opt_reload_hit_only */ opt_reload_hit_only = 1; - break; #if USE_WIN32_SERVICE case 'i': + /** \par i + * Set global option opt_install_service (to TRUE) */ opt_install_service = TRUE; - break; - #endif case 'a': + /** \par a + * Add optional HTTP port as given following the option */ add_http_port(optarg); - break; case 'd': + /** \par d + * Set global option opt_debug_stderr to the number given follwoign the option */ opt_debug_stderr = atoi(optarg); - break; case 'f': + /** \par f + * Load the file given instead of the default squid.conf. */ xfree(ConfigFile); - ConfigFile = xstrdup(optarg); - - break; - - case 'h': - usage(); - break; case 'k': + /** \par k + * Run the administrative action given following the option */ + /** \li When its an unknown option display the usage help. */ if ((int) strlen(optarg) < 1) usage(); if (!strncmp(optarg, "reconfigure", strlen(optarg))) + /** \li On reconfigure send SIGHUP. */ opt_send_signal = SIGHUP; else if (!strncmp(optarg, "rotate", strlen(optarg))) + /** \li On rotate send SIGQUIT or SIGUSR1. */ #ifdef _SQUID_LINUX_THREADS_ opt_send_signal = SIGQUIT; @@ -351,6 +371,7 @@ #endif else if (!strncmp(optarg, "debug", strlen(optarg))) + /** \li On debug send SIGTRAP or SIGUSR2. */ #ifdef _SQUID_LINUX_THREADS_ opt_send_signal = SIGTRAP; @@ -362,34 +383,42 @@ #endif else if (!strncmp(optarg, "shutdown", strlen(optarg))) + /** \li On shutdown send SIGTERM. */ opt_send_signal = SIGTERM; else if (!strncmp(optarg, "interrupt", strlen(optarg))) + /** \li On interrupt send SIGINT. */ opt_send_signal = SIGINT; else if (!strncmp(optarg, "kill", strlen(optarg))) + /** \li On kill send SIGKILL. */ opt_send_signal = SIGKILL; #ifdef SIGTTIN else if (!strncmp(optarg, "restart", strlen(optarg))) - opt_send_signal = SIGTTIN; /* exit and restart by parent */ + /** \li On restart send SIGTTIN. (exit and restart by parent) */ + opt_send_signal = SIGTTIN; #endif else if (!strncmp(optarg, "check", strlen(optarg))) + /** \li On check send 0 / SIGNULL. */ opt_send_signal = 0; /* SIGNULL */ else if (!strncmp(optarg, "parse", strlen(optarg))) - opt_parse_cfg_only = 1; /* parse cfg file only */ + /** \li On parse set global flag to re-parse the config file only. */ + opt_parse_cfg_only = 1; else usage(); break; case 'm': + /** \par m + * Set global malloc_debug_level to the value given following the option. + * if none is given it toggles the xmalloc_trace option on/off */ if (optarg) { #if MALLOC_DBG malloc_debug_level = atoi(optarg); #else - fatal("Need to add -DMALLOC_DBG when compiling to use -mX option"); #endif @@ -397,18 +426,17 @@ #if XMALLOC_TRACE xmalloc_trace = !xmalloc_trace; #else - fatal("Need to configure --enable-xmalloc-debug-trace to use -m option"); #endif - } - break; - /* NOTREACHED */ #if USE_WIN32_SERVICE case 'n': + /** \par n + * Set global option opt_signal_service (to TRUE). + * Stores the additional parameter given in global WIN32_Service_name */ xfree(WIN32_Service_name); WIN32_Service_name = xstrdup(optarg); @@ -418,6 +446,8 @@ break; case 'r': + /** \par r + * Set global option opt_remove_service (to TRUE) */ opt_remove_service = TRUE; break; @@ -425,9 +455,14 @@ #endif case 'l': + /** \par l + * Stores the syslog facility name in global opt_syslog_facility + * then performs actions for -s option. */ opt_syslog_facility = xstrdup(optarg); case 's': + /** \par s + * Initialize the syslog for output */ #if HAVE_SYSLOG _db_set_syslog(opt_syslog_facility); @@ -442,6 +477,9 @@ #endif case 'u': + /** \par u + * Store the ICP port number given in global option icpPortNumOverride + * ensuring its a positive number. */ icpPortNumOverride = atoi(optarg); if (icpPortNumOverride < 0) @@ -450,6 +488,8 @@ break; case 'v': + /** \par v + * Display squid version and build information. Then exit. */ printf("Squid Cache: Version %s\nconfigure options: %s\n", version_string, SQUID_CONFIGURE_OPTIONS); #if USE_WIN32_SERVICE @@ -463,15 +503,21 @@ /* NOTREACHED */ case 'z': + /** \par z + * Set global option opt_debug_stderr and opt_create_swap_dirs */ opt_debug_stderr = 1; opt_create_swap_dirs = 1; break; + case 'h': + case '?': default: + /** \par h,?, or unknown + * \copydoc usage() */ usage(); break;