the -q switch

This commit is contained in:
Igor Sysoev 2010-09-02 13:43:02 +00:00
parent f7dd767e57
commit 2cb30f153f
3 changed files with 15 additions and 4 deletions

View File

@ -212,7 +212,7 @@ main(int argc, char *const *argv)
if (ngx_show_help) { if (ngx_show_help) {
ngx_log_stderr(0, ngx_log_stderr(0,
"Usage: nginx [-?hvVt] [-s signal] [-c filename] " "Usage: nginx [-?hvVtq] [-s signal] [-c filename] "
"[-p prefix] [-g directives]" CRLF CRLF "[-p prefix] [-g directives]" CRLF CRLF
"Options:" CRLF "Options:" CRLF
" -?,-h : this help" CRLF " -?,-h : this help" CRLF
@ -220,6 +220,8 @@ main(int argc, char *const *argv)
" -V : show version and configure options then exit" " -V : show version and configure options then exit"
CRLF CRLF
" -t : test configuration and exit" CRLF " -t : test configuration and exit" CRLF
" -q : suppress non-error messages "
"during configuration testing" CRLF
" -s signal : send signal to a master process: " " -s signal : send signal to a master process: "
"stop, quit, reopen, reload" CRLF "stop, quit, reopen, reload" CRLF
#ifdef NGX_PREFIX #ifdef NGX_PREFIX
@ -332,8 +334,11 @@ main(int argc, char *const *argv)
} }
if (ngx_test_config) { if (ngx_test_config) {
ngx_log_stderr(0, "configuration file %s test is successful", if (!ngx_quiet_mode) {
cycle->conf_file.data); ngx_log_stderr(0, "configuration file %s test is successful",
cycle->conf_file.data);
}
return 0; return 0;
} }
@ -685,6 +690,10 @@ ngx_get_options(int argc, char *const *argv)
ngx_test_config = 1; ngx_test_config = 1;
break; break;
case 'q':
ngx_quiet_mode = 1;
break;
case 'p': case 'p':
if (*p) { if (*p) {
ngx_prefix = p; ngx_prefix = p;

View File

@ -24,6 +24,7 @@ static ngx_pool_t *ngx_temp_pool;
static ngx_event_t ngx_cleaner_event; static ngx_event_t ngx_cleaner_event;
ngx_uint_t ngx_test_config; ngx_uint_t ngx_test_config;
ngx_uint_t ngx_quiet_mode;
#if (NGX_THREADS) #if (NGX_THREADS)
ngx_tls_key_t ngx_core_tls_key; ngx_tls_key_t ngx_core_tls_key;
@ -266,7 +267,7 @@ ngx_init_cycle(ngx_cycle_t *old_cycle)
return NULL; return NULL;
} }
if (ngx_test_config) { if (ngx_test_config && !ngx_quiet_mode) {
ngx_log_stderr(0, "the configuration file %s syntax is ok", ngx_log_stderr(0, "the configuration file %s syntax is ok",
cycle->conf_file.data); cycle->conf_file.data);
} }

View File

@ -130,6 +130,7 @@ extern volatile ngx_cycle_t *ngx_cycle;
extern ngx_array_t ngx_old_cycles; extern ngx_array_t ngx_old_cycles;
extern ngx_module_t ngx_core_module; extern ngx_module_t ngx_core_module;
extern ngx_uint_t ngx_test_config; extern ngx_uint_t ngx_test_config;
extern ngx_uint_t ngx_quiet_mode;
#if (NGX_THREADS) #if (NGX_THREADS)
extern ngx_tls_key_t ngx_core_tls_key; extern ngx_tls_key_t ngx_core_tls_key;
#endif #endif