Mercurial > hg > nginx
comparison src/core/nginx.c @ 2722:ffa8e2451457
show -t results on stderr
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Sun, 19 Apr 2009 16:06:09 +0000 |
parents | a6d6d762c554 |
children | d43d73277c5c |
comparison
equal
deleted
inserted
replaced
2721:8e720b7fe6d2 | 2722:ffa8e2451457 |
---|---|
189 | 189 |
190 | 190 |
191 int ngx_cdecl | 191 int ngx_cdecl |
192 main(int argc, char *const *argv) | 192 main(int argc, char *const *argv) |
193 { | 193 { |
194 char *p; | |
195 ssize_t n; | |
196 ngx_int_t i; | 194 ngx_int_t i; |
197 ngx_log_t *log; | 195 ngx_log_t *log; |
198 ngx_cycle_t *cycle, init_cycle; | 196 ngx_cycle_t *cycle, init_cycle; |
199 ngx_core_conf_t *ccf; | 197 ngx_core_conf_t *ccf; |
200 | 198 |
241 return 1; | 239 return 1; |
242 } | 240 } |
243 | 241 |
244 if (ngx_show_version) { | 242 if (ngx_show_version) { |
245 | 243 |
246 p = "nginx version: " NGINX_VER CRLF; | 244 ngx_log_stderr("nginx version: " NGINX_VER); |
247 n = sizeof("nginx version: " NGINX_VER CRLF) - 1; | |
248 | |
249 if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) { | |
250 return 1; | |
251 } | |
252 | 245 |
253 if (ngx_show_configure) { | 246 if (ngx_show_configure) { |
254 #ifdef NGX_COMPILER | 247 #ifdef NGX_COMPILER |
255 p = "built by " NGX_COMPILER CRLF; | 248 ngx_log_stderr("built by " NGX_COMPILER); |
256 n = sizeof("built by " NGX_COMPILER CRLF) - 1; | 249 #endif |
257 | 250 |
258 if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) { | 251 ngx_log_stderr("configure arguments: " NGX_CONFIGURE); |
259 return 1; | |
260 } | |
261 #endif | |
262 | |
263 p = "configure arguments: " NGX_CONFIGURE CRLF; | |
264 n = sizeof("configure arguments :" NGX_CONFIGURE CRLF) - 1; | |
265 | |
266 if (ngx_write_fd(ngx_stderr_fileno, p, n) != n) { | |
267 return 1; | |
268 } | |
269 } | 252 } |
270 | 253 |
271 if (!ngx_test_config) { | 254 if (!ngx_test_config) { |
272 return 0; | 255 return 0; |
273 } | 256 } |
299 } | 282 } |
300 | 283 |
301 cycle = ngx_init_cycle(&init_cycle); | 284 cycle = ngx_init_cycle(&init_cycle); |
302 if (cycle == NULL) { | 285 if (cycle == NULL) { |
303 if (ngx_test_config) { | 286 if (ngx_test_config) { |
304 ngx_log_error(NGX_LOG_EMERG, log, 0, | 287 ngx_log_stderr("the configuration file %s test failed", |
305 "the configuration file %s test failed", | 288 init_cycle.conf_file.data); |
306 init_cycle.conf_file.data); | |
307 } | 289 } |
308 | 290 |
309 return 1; | 291 return 1; |
310 } | 292 } |
311 | 293 |
312 if (ngx_test_config) { | 294 if (ngx_test_config) { |
313 ngx_log_error(NGX_LOG_INFO, log, 0, | 295 ngx_log_stderr("the configuration file %s was tested successfully", |
314 "the configuration file %s was tested successfully", | 296 cycle->conf_file.data); |
315 cycle->conf_file.data); | |
316 return 0; | 297 return 0; |
317 } | 298 } |
318 | 299 |
319 ngx_os_status(cycle->log); | 300 ngx_os_status(cycle->log); |
320 | 301 |