diff src/core/nginx.c @ 317:1308b98496a2

nginx-0.0.3-2004-04-15-19:34:36 import
author Igor Sysoev <igor@sysoev.ru>
date Thu, 15 Apr 2004 15:34:36 +0000
parents a0beefedaf94
children 56496082668b
line wrap: on
line diff
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -70,12 +70,14 @@ ngx_module_t  ngx_core_module = {
 };
 
 
-ngx_int_t  ngx_max_module;
+ngx_int_t   ngx_max_module;
 
-ngx_int_t  ngx_process;
-ngx_pid_t  ngx_pid;
-ngx_pid_t  ngx_new_binary;
-ngx_int_t  ngx_inherited;
+ngx_int_t   ngx_process;
+ngx_pid_t   ngx_pid;
+ngx_pid_t   ngx_new_binary;
+ngx_int_t   ngx_inherited;
+
+ngx_uint_t  ngx_test_config;
 
 
 int main(int argc, char *const *argv)
@@ -125,11 +127,6 @@ int main(int argc, char *const *argv)
         return 1;
     }
 
-    ngx_max_module = 0;
-    for (i = 0; ngx_modules[i]; i++) {
-        ngx_modules[i]->index = ngx_max_module++;
-    }
-
     if (!(init_cycle.pool = ngx_create_pool(1024, log))) {
         return 1;
     }
@@ -138,11 +135,20 @@ int main(int argc, char *const *argv)
         return 1;
     }
 
+    ngx_max_module = 0;
+    for (i = 0; ngx_modules[i]; i++) {
+        ngx_modules[i]->index = ngx_max_module++;
+    }
+
     cycle = ngx_init_cycle(&init_cycle);
     if (cycle == NULL) {
         return 1;
     }
 
+    if (ngx_test_config) {
+        return 0;
+    }
+
     ngx_cycle = cycle;
 
     ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module);
@@ -276,6 +282,10 @@ static ngx_int_t ngx_getopt(ngx_master_c
 
         switch (ctx->argv[i][1]) {
 
+        case 't':
+            ngx_test_config = 1;
+            break;
+
         case 'c':
             if (ctx->argv[i + 1] == NULL) {
                 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,