Issue 5852 (casper) Code clean up, adding documentation on new switches. Thanks!

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@16616 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Olle Johansson
2006-03-31 00:33:28 +00:00
parent adf8c8deda
commit d80f3bc20e

View File

@@ -30,7 +30,7 @@
* *
* \section copyright Copyright and author * \section copyright Copyright and author
* *
* Copyright (C) 1999 - 2005, Digium, Inc. * Copyright (C) 1999 - 2006, Digium, Inc.
* Asterisk is a trade mark registered by Digium, Inc. * Asterisk is a trade mark registered by Digium, Inc.
* *
* \author Mark Spencer <markster@digium.com> * \author Mark Spencer <markster@digium.com>
@@ -1822,7 +1822,7 @@ static int show_version(void)
} }
static int show_cli_help(void) { static int show_cli_help(void) {
printf("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2005, Digium, Inc. and others.\n"); printf("Asterisk " ASTERISK_VERSION ", Copyright (C) 1999 - 2006, Digium, Inc. and others.\n");
printf("Usage: asterisk [OPTIONS]\n"); printf("Usage: asterisk [OPTIONS]\n");
printf("Valid Options:\n"); printf("Valid Options:\n");
printf(" -V Display version number and exit\n"); printf(" -V Display version number and exit\n");
@@ -1835,6 +1835,9 @@ static int show_cli_help(void) {
printf(" -g Dump core in case of a crash\n"); printf(" -g Dump core in case of a crash\n");
printf(" -h This help screen\n"); printf(" -h This help screen\n");
printf(" -i Initialize crypto keys at startup\n"); printf(" -i Initialize crypto keys at startup\n");
printf(" -I Enable internal timing if Zaptel timer is available\n");
printf(" -L <load> Limit the maximum load average before rejecting new calls\n");
printf(" -M <value> Limit the maximum number of calls to the specified value\n");
printf(" -n Disable console colorization\n"); printf(" -n Disable console colorization\n");
printf(" -p Run as pseudo-realtime thread\n"); printf(" -p Run as pseudo-realtime thread\n");
printf(" -q Quiet mode (suppress output)\n"); printf(" -q Quiet mode (suppress output)\n");
@@ -2039,18 +2042,11 @@ int main(int argc, char *argv[])
tdd_init(); tdd_init();
/* When Asterisk restarts after it has dropped the root privileges, /* When Asterisk restarts after it has dropped the root privileges,
* it can't issue setuid(), setgid(), setgroups() or set_priority() * it can't issue setuid(), setgid(), setgroups() or set_priority()
* */ */
if (getenv("ASTERISK_ALREADY_NONROOT")) if (getenv("ASTERISK_ALREADY_NONROOT"))
is_child_of_nonroot=1; is_child_of_nonroot=1;
if (getenv("HOME")) if (getenv("HOME"))
snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME")); snprintf(filename, sizeof(filename), "%s/.asterisk_history", getenv("HOME"));
/* Check if we're root */
/*
if (geteuid()) {
ast_log(LOG_ERROR, "Must be run as root\n");
exit(1);
}
*/
/* Check for options */ /* Check for options */
while ((c = getopt(argc, argv, "tThfdvVqprRgciInx:U:G:C:L:M:")) != -1) { while ((c = getopt(argc, argv, "tThfdvVqprRgciInx:U:G:C:L:M:")) != -1) {
switch (c) { switch (c) {
@@ -2091,7 +2087,6 @@ int main(int argc, char *argv[])
case 'q': case 'q':
ast_set_flag(&ast_options, AST_OPT_FLAG_QUIET); ast_set_flag(&ast_options, AST_OPT_FLAG_QUIET);
break; break;
break;
case 't': case 't':
ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES); ast_set_flag(&ast_options, AST_OPT_FLAG_CACHE_RECORD_FILES);
break; break;
@@ -2160,6 +2155,7 @@ int main(int argc, char *argv[])
rungroup = ast_config_AST_RUN_GROUP; rungroup = ast_config_AST_RUN_GROUP;
if ((!runuser) && !ast_strlen_zero(ast_config_AST_RUN_USER)) if ((!runuser) && !ast_strlen_zero(ast_config_AST_RUN_USER))
runuser = ast_config_AST_RUN_USER; runuser = ast_config_AST_RUN_USER;
#ifndef __CYGWIN__ #ifndef __CYGWIN__
if (!is_child_of_nonroot) if (!is_child_of_nonroot)
@@ -2230,7 +2226,6 @@ int main(int argc, char *argv[])
register_config_cli(); register_config_cli();
read_config_maps(); read_config_maps();
if (ast_opt_console) { if (ast_opt_console) {
if (el_hist == NULL || el == NULL) if (el_hist == NULL || el == NULL)
ast_el_initialize(); ast_el_initialize();
@@ -2390,7 +2385,6 @@ int main(int argc, char *argv[])
ast_rtp_reload(); ast_rtp_reload();
#endif #endif
/* We might have the option of showing a console, but for now just /* We might have the option of showing a console, but for now just
do nothing... */ do nothing... */
if (ast_opt_console && !option_verbose) if (ast_opt_console && !option_verbose)