comparison src/core/ngx_conf_file.c @ 118:5bf52498665c

nginx-0.0.1-2003-07-18-18:44:05 import
author Igor Sysoev <igor@sysoev.ru>
date Fri, 18 Jul 2003 14:44:05 +0000
parents f6e3c5d019b6
children cd54bcbaf3b5
comparison
equal deleted inserted replaced
117:f6e3c5d019b6 118:5bf52498665c
125 while (cmd->name.len) { 125 while (cmd->name.len) {
126 if (name->len == cmd->name.len 126 if (name->len == cmd->name.len
127 && ngx_strcmp(name->data, cmd->name.data) == 0) 127 && ngx_strcmp(name->data, cmd->name.data) == 0)
128 { 128 {
129 129
130 found = 1;
130 #if 0 131 #if 0
131 ngx_log_debug(cf->log, "command '%s'" _ cmd->name.data); 132 ngx_log_debug(cf->log, "command '%s'" _ cmd->name.data);
132 #endif 133 #endif
133 /* is the directive's location right ? */ 134 /* is the directive's location right ? */
134 135
202 #if 0 203 #if 0
203 ngx_log_debug(cf->log, "rv: %d" _ rv); 204 ngx_log_debug(cf->log, "rv: %d" _ rv);
204 #endif 205 #endif
205 206
206 if (rv == NGX_CONF_OK) { 207 if (rv == NGX_CONF_OK) {
207 found = 1;
208 break; 208 break;
209 209
210 } else if (rv == NGX_CONF_ERROR) { 210 } else if (rv == NGX_CONF_ERROR) {
211 rc = NGX_ERROR; 211 rc = NGX_ERROR;
212 break; 212 break;
218 rv, 218 rv,
219 cf->conf_file->file.name.data, 219 cf->conf_file->file.name.data,
220 cf->conf_file->line); 220 cf->conf_file->line);
221 } else { 221 } else {
222 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, 222 ngx_log_error(NGX_LOG_EMERG, cf->log, 0,
223 "%s %s in %s:%d", 223 "\"%s\" directive %s in %s:%d",
224 name->data, rv, 224 name->data, rv,
225 cf->conf_file->file.name.data, 225 cf->conf_file->file.name.data,
226 cf->conf_file->line); 226 cf->conf_file->line);
227 } 227 }
228 228
241 name->data, 241 name->data,
242 cf->conf_file->file.name.data, 242 cf->conf_file->file.name.data,
243 cf->conf_file->line); 243 cf->conf_file->line);
244 244
245 rc = NGX_ERROR; 245 rc = NGX_ERROR;
246 break;
247 }
248
249 if (rc == NGX_ERROR) {
246 break; 250 break;
247 } 251 }
248 } 252 }
249 253
250 if (filename) { 254 if (filename) {
469 } 473 }
470 } 474 }
471 } 475 }
472 476
473 477
478 void ngx_conf_log_error(int level, ngx_conf_t *cf, ngx_err_t err,
479 char *fmt, ...)
480 {
481 int len;
482 char errstr[MAX_CONF_ERRSTR];
483 va_list args;
484
485 va_start(args, fmt);
486 len = ngx_vsnprintf(errstr, sizeof(errstr) - 1, fmt, args);
487 va_end(args);
488
489 if (err) {
490 len += ngx_snprintf(errstr + len, sizeof(errstr) - len - 1,
491 " (%d: ", err);
492 len += ngx_strerror_r(err, errstr + len, sizeof(errstr) - len - 1);
493 errstr[len++] = ')';
494 errstr[len++] = '\0';
495 }
496
497 ngx_log_error(level, cf->log, 0, "%s in %s:%d",
498 errstr, cf->conf_file->file.name.data, cf->conf_file->line);
499 }
500
501
474 char *ngx_conf_set_core_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd, 502 char *ngx_conf_set_core_flag_slot(ngx_conf_t *cf, ngx_command_t *cmd,
475 void *conf) 503 void *conf)
476 { 504 {
477 return ngx_conf_set_flag_slot(cf, cmd, *(void **)conf); 505 return ngx_conf_set_flag_slot(cf, cmd, *(void **)conf);
478 } 506 }