comparison src/core/nginx.c @ 443:33aec431094b

nginx-0.1.0-2004-09-29-00:09:22 import
author Igor Sysoev <igor@sysoev.ru>
date Tue, 28 Sep 2004 20:09:22 +0000
parents da8c5707af39
children 42d11f017717
comparison
equal deleted inserted replaced
442:464aaa791e2b 443:33aec431094b
93 }; 93 };
94 94
95 95
96 ngx_uint_t ngx_max_module; 96 ngx_uint_t ngx_max_module;
97 97
98 ngx_uint_t ngx_use_stderr;
99
98 100
99 int main(int argc, char *const *argv) 101 int main(int argc, char *const *argv)
100 { 102 {
101 ngx_int_t i; 103 ngx_int_t i;
102 ngx_log_t *log; 104 ngx_log_t *log;
114 116
115 #if (HAVE_PCRE) 117 #if (HAVE_PCRE)
116 ngx_regex_init(); 118 ngx_regex_init();
117 #endif 119 #endif
118 120
121 ngx_pid = ngx_getpid();
122
119 log = ngx_log_init_errlog(); 123 log = ngx_log_init_errlog();
120 ngx_pid = ngx_getpid();
121 124
122 #if (NGX_OPENSSL) 125 #if (NGX_OPENSSL)
123 ngx_ssl_init(log); 126 ngx_ssl_init(log);
124 #endif 127 #endif
125 128
131 134
132 ngx_memzero(&ctx, sizeof(ngx_master_ctx_t)); 135 ngx_memzero(&ctx, sizeof(ngx_master_ctx_t));
133 ctx.argc = argc; 136 ctx.argc = argc;
134 ctx.argv = argv; 137 ctx.argv = argv;
135 138
136 if (ngx_os_init(log) == NGX_ERROR) {
137 return 1;
138 }
139
140 if (!(init_cycle.pool = ngx_create_pool(1024, log))) { 139 if (!(init_cycle.pool = ngx_create_pool(1024, log))) {
141 return 1; 140 return 1;
142 } 141 }
143 142
144 if (ngx_getopt(&ctx, &init_cycle) == NGX_ERROR) { 143 if (ngx_getopt(&ctx, &init_cycle) == NGX_ERROR) {
144 return 1;
145 }
146
147 if (ngx_use_stderr) {
148 log = ngx_log_init_errlog();
149 }
150
151 if (ngx_os_init(log) == NGX_ERROR) {
145 return 1; 152 return 1;
146 } 153 }
147 154
148 if (ngx_add_inherited_sockets(&init_cycle) == NGX_ERROR) { 155 if (ngx_add_inherited_sockets(&init_cycle) == NGX_ERROR) {
149 return 1; 156 return 1;
315 322
316 switch (ctx->argv[i][1]) { 323 switch (ctx->argv[i][1]) {
317 324
318 case 't': 325 case 't':
319 ngx_test_config = 1; 326 ngx_test_config = 1;
327 break;
328
329 case 's':
330 ngx_use_stderr = 1;
320 break; 331 break;
321 332
322 case 'c': 333 case 'c':
323 if (ctx->argv[i + 1] == NULL) { 334 if (ctx->argv[i + 1] == NULL) {
324 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0, 335 ngx_log_error(NGX_LOG_EMERG, cycle->log, 0,