Mercurial > hg > nginx
comparison 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 |
comparison
equal
deleted
inserted
replaced
316:a0beefedaf94 | 317:1308b98496a2 |
---|---|
68 NULL, /* init module */ | 68 NULL, /* init module */ |
69 NULL /* init child */ | 69 NULL /* init child */ |
70 }; | 70 }; |
71 | 71 |
72 | 72 |
73 ngx_int_t ngx_max_module; | 73 ngx_int_t ngx_max_module; |
74 | 74 |
75 ngx_int_t ngx_process; | 75 ngx_int_t ngx_process; |
76 ngx_pid_t ngx_pid; | 76 ngx_pid_t ngx_pid; |
77 ngx_pid_t ngx_new_binary; | 77 ngx_pid_t ngx_new_binary; |
78 ngx_int_t ngx_inherited; | 78 ngx_int_t ngx_inherited; |
79 | |
80 ngx_uint_t ngx_test_config; | |
79 | 81 |
80 | 82 |
81 int main(int argc, char *const *argv) | 83 int main(int argc, char *const *argv) |
82 { | 84 { |
83 ngx_int_t i; | 85 ngx_int_t i; |
123 | 125 |
124 if (ngx_os_init(log) == NGX_ERROR) { | 126 if (ngx_os_init(log) == NGX_ERROR) { |
125 return 1; | 127 return 1; |
126 } | 128 } |
127 | 129 |
130 if (!(init_cycle.pool = ngx_create_pool(1024, log))) { | |
131 return 1; | |
132 } | |
133 | |
134 if (ngx_add_inherited_sockets(&init_cycle) == NGX_ERROR) { | |
135 return 1; | |
136 } | |
137 | |
128 ngx_max_module = 0; | 138 ngx_max_module = 0; |
129 for (i = 0; ngx_modules[i]; i++) { | 139 for (i = 0; ngx_modules[i]; i++) { |
130 ngx_modules[i]->index = ngx_max_module++; | 140 ngx_modules[i]->index = ngx_max_module++; |
131 } | 141 } |
132 | 142 |
133 if (!(init_cycle.pool = ngx_create_pool(1024, log))) { | |
134 return 1; | |
135 } | |
136 | |
137 if (ngx_add_inherited_sockets(&init_cycle) == NGX_ERROR) { | |
138 return 1; | |
139 } | |
140 | |
141 cycle = ngx_init_cycle(&init_cycle); | 143 cycle = ngx_init_cycle(&init_cycle); |
142 if (cycle == NULL) { | 144 if (cycle == NULL) { |
143 return 1; | 145 return 1; |
146 } | |
147 | |
148 if (ngx_test_config) { | |
149 return 0; | |
144 } | 150 } |
145 | 151 |
146 ngx_cycle = cycle; | 152 ngx_cycle = cycle; |
147 | 153 |
148 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); | 154 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, ngx_core_module); |
274 return NGX_ERROR; | 280 return NGX_ERROR; |
275 } | 281 } |
276 | 282 |
277 switch (ctx->argv[i][1]) { | 283 switch (ctx->argv[i][1]) { |
278 | 284 |
285 case 't': | |
286 ngx_test_config = 1; | |
287 break; | |
288 | |
279 case 'c': | 289 case 'c': |
280 if (ctx->argv[i + 1] == NULL) { | 290 if (ctx->argv[i + 1] == NULL) { |
281 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, | 291 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, |
282 "the option: \"%s\" requires file name", | 292 "the option: \"%s\" requires file name", |
283 ctx->argv[i]); | 293 ctx->argv[i]); |