changeset 3750:ffbdaa3c70d6

the -q switch
author Igor Sysoev <igor@sysoev.ru>
date Thu, 02 Sep 2010 13:43:02 +0000
parents 3ee39f593642
children a4755d4fd91b
files src/core/nginx.c src/core/ngx_cycle.c src/core/ngx_cycle.h
diffstat 3 files changed, 15 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/core/nginx.c	Thu Aug 26 12:33:08 2010 +0000
+++ b/src/core/nginx.c	Thu Sep 02 13:43:02 2010 +0000
@@ -212,7 +212,7 @@
 
         if (ngx_show_help) {
             ngx_log_stderr(0,
-                "Usage: nginx [-?hvVt] [-s signal] [-c filename] "
+                "Usage: nginx [-?hvVtq] [-s signal] [-c filename] "
                              "[-p prefix] [-g directives]" CRLF CRLF
                 "Options:" CRLF
                 "  -?,-h         : this help" CRLF
@@ -220,6 +220,8 @@
                 "  -V            : show version and configure options then 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: "
                                    "stop, quit, reopen, reload" CRLF
 #ifdef NGX_PREFIX
@@ -332,8 +334,11 @@
     }
 
     if (ngx_test_config) {
-        ngx_log_stderr(0, "configuration file %s test is successful",
-                       cycle->conf_file.data);
+        if (!ngx_quiet_mode) {
+            ngx_log_stderr(0, "configuration file %s test is successful",
+                           cycle->conf_file.data);
+        }
+
         return 0;
     }
 
@@ -685,6 +690,10 @@
                 ngx_test_config = 1;
                 break;
 
+            case 'q':
+                ngx_quiet_mode = 1;
+                break;
+
             case 'p':
                 if (*p) {
                     ngx_prefix = p;
--- a/src/core/ngx_cycle.c	Thu Aug 26 12:33:08 2010 +0000
+++ b/src/core/ngx_cycle.c	Thu Sep 02 13:43:02 2010 +0000
@@ -24,6 +24,7 @@
 static ngx_event_t     ngx_cleaner_event;
 
 ngx_uint_t             ngx_test_config;
+ngx_uint_t             ngx_quiet_mode;
 
 #if (NGX_THREADS)
 ngx_tls_key_t          ngx_core_tls_key;
@@ -266,7 +267,7 @@
         return NULL;
     }
 
-    if (ngx_test_config) {
+    if (ngx_test_config && !ngx_quiet_mode) {
         ngx_log_stderr(0, "the configuration file %s syntax is ok",
                        cycle->conf_file.data);
     }
--- a/src/core/ngx_cycle.h	Thu Aug 26 12:33:08 2010 +0000
+++ b/src/core/ngx_cycle.h	Thu Sep 02 13:43:02 2010 +0000
@@ -130,6 +130,7 @@
 extern ngx_array_t            ngx_old_cycles;
 extern ngx_module_t           ngx_core_module;
 extern ngx_uint_t             ngx_test_config;
+extern ngx_uint_t             ngx_quiet_mode;
 #if (NGX_THREADS)
 extern ngx_tls_key_t          ngx_core_tls_key;
 #endif