Mercurial > hg > nginx
comparison src/core/ngx_conf_file.c @ 1124:f1a8c6cd10ba
ngx_log_error() > ngx_conf_log_error()
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 20 Feb 2007 15:47:54 +0000 |
parents | 88dc269bbca2 |
children | 2c2271d3aac5 |
comparison
equal
deleted
inserted
replaced
1123:88dc269bbca2 | 1124:f1a8c6cd10ba |
---|---|
152 | 152 |
153 block = 0; | 153 block = 0; |
154 } | 154 } |
155 | 155 |
156 if (rc == NGX_CONF_FILE_DONE && block) { | 156 if (rc == NGX_CONF_FILE_DONE && block) { |
157 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 157 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
158 "unexpected end of file in %s:%ui, expecting \"}\"", | 158 "unexpected end of file, expecting \"}\""); |
159 cf->conf_file->file.name.data, | |
160 cf->conf_file->line); | |
161 goto failed; | 159 goto failed; |
162 } | 160 } |
163 | 161 |
164 if (rc != NGX_OK && rc != NGX_CONF_BLOCK_START) { | 162 if (rc != NGX_OK && rc != NGX_CONF_BLOCK_START) { |
165 goto done; | 163 goto done; |
179 | 177 |
180 if (rv == NGX_CONF_ERROR) { | 178 if (rv == NGX_CONF_ERROR) { |
181 goto failed; | 179 goto failed; |
182 } | 180 } |
183 | 181 |
184 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 182 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, rv); |
185 "%s in %s:%ui", | |
186 rv, cf->conf_file->file.name.data, | |
187 cf->conf_file->line); | |
188 | 183 |
189 goto failed; | 184 goto failed; |
190 } | 185 } |
191 | 186 |
192 | 187 |
273 | 268 |
274 goto not_allowed; | 269 goto not_allowed; |
275 } | 270 } |
276 | 271 |
277 if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) { | 272 if (!(cmd->type & NGX_CONF_BLOCK) && last != NGX_OK) { |
278 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 273 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
279 "directive \"%s\" in %s:%ui " | 274 "directive \"%s\" is not terminated by \";\"", |
280 "is not terminated by \";\"", | 275 name->data); |
281 name->data, cf->conf_file->file.name.data, | |
282 cf->conf_file->line); | |
283 return NGX_ERROR; | 276 return NGX_ERROR; |
284 } | 277 } |
285 | 278 |
286 if ((cmd->type & NGX_CONF_BLOCK) && last != NGX_CONF_BLOCK_START) { | 279 if ((cmd->type & NGX_CONF_BLOCK) && last != NGX_CONF_BLOCK_START) { |
287 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 280 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
288 "directive \"%s\" in %s:%ui " | 281 "directive \"%s\" has no opening \"{\"", |
289 "has not the opening \"{\"", | 282 name->data); |
290 name->data, cf->conf_file->file.name.data, | |
291 cf->conf_file->line); | |
292 return NGX_ERROR; | 283 return NGX_ERROR; |
293 } | 284 } |
294 | 285 |
295 /* is the directive's argument count right ? */ | 286 /* is the directive's argument count right ? */ |
296 | 287 |
350 | 341 |
351 if (rv == NGX_CONF_ERROR) { | 342 if (rv == NGX_CONF_ERROR) { |
352 return NGX_ERROR; | 343 return NGX_ERROR; |
353 } | 344 } |
354 | 345 |
355 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 346 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
356 "the \"%s\" directive %s in %s:%ui", | 347 "the \"%s\" directive %s", name->data, rv); |
357 name->data, rv, cf->conf_file->file.name.data, | |
358 cf->conf_file->line); | |
359 | 348 |
360 return NGX_ERROR; | 349 return NGX_ERROR; |
361 } | 350 } |
362 } | 351 } |
363 | 352 |
364 if (multi == 0) { | 353 if (multi == 0) { |
365 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 354 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
366 "unknown directive \"%s\" in %s:%ui", | 355 "unknown directive \"%s\"", name->data); |
367 name->data, cf->conf_file->file.name.data, | |
368 cf->conf_file->line); | |
369 | 356 |
370 return NGX_ERROR; | 357 return NGX_ERROR; |
371 } | 358 } |
372 | 359 |
373 not_allowed: | 360 not_allowed: |
374 | 361 |
375 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 362 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
376 "directive \"%s\" in %s:%ui " | 363 "directive \"%s\" is not allowed here", name->data); |
377 "is not allowed here", | |
378 name->data, cf->conf_file->file.name.data, | |
379 cf->conf_file->line); | |
380 return NGX_ERROR; | 364 return NGX_ERROR; |
381 | 365 |
382 invalid: | 366 invalid: |
383 | 367 |
384 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 368 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
385 "invalid number arguments in " | 369 "invalid number arguments in directive \"%s\"", |
386 "directive \"%s\" in %s:%ui", | 370 name->data); |
387 name->data, cf->conf_file->file.name.data, | |
388 cf->conf_file->line); | |
389 | 371 |
390 return NGX_ERROR; | 372 return NGX_ERROR; |
391 } | 373 } |
392 | 374 |
393 | 375 |
418 if (b->pos >= b->last) { | 400 if (b->pos >= b->last) { |
419 if (cf->conf_file->file.offset | 401 if (cf->conf_file->file.offset |
420 >= ngx_file_size(&cf->conf_file->file.info)) | 402 >= ngx_file_size(&cf->conf_file->file.info)) |
421 { | 403 { |
422 if (cf->args->nelts > 0) { | 404 if (cf->args->nelts > 0) { |
423 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 405 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
424 "unexpected end of file in %s:%ui, " | 406 "unexpected end of file, " |
425 "expecting \";\" or \"}\"", | 407 "expecting \";\" or \"}\""); |
426 cf->conf_file->file.name.data, | |
427 cf->conf_file->line); | |
428 return NGX_ERROR; | 408 return NGX_ERROR; |
429 } | 409 } |
430 | 410 |
431 return NGX_CONF_FILE_DONE; | 411 return NGX_CONF_FILE_DONE; |
432 } | 412 } |
486 if (ch == ')') { | 466 if (ch == ')') { |
487 last_space = 1; | 467 last_space = 1; |
488 need_space = 0; | 468 need_space = 0; |
489 | 469 |
490 } else { | 470 } else { |
491 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 471 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
492 "unexpected \"%c\" in %s:%ui", | 472 "unexpected \"%c\"", ch); |
493 ch, cf->conf_file->file.name.data, | |
494 cf->conf_file->line); | |
495 | |
496 return NGX_ERROR; | 473 return NGX_ERROR; |
497 } | 474 } |
498 } | 475 } |
499 | 476 |
500 if (last_space) { | 477 if (last_space) { |
507 switch (ch) { | 484 switch (ch) { |
508 | 485 |
509 case ';': | 486 case ';': |
510 case '{': | 487 case '{': |
511 if (cf->args->nelts == 0) { | 488 if (cf->args->nelts == 0) { |
512 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 489 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
513 "unexpected \"%c\" in %s:%ui", | 490 "unexpected \"%c\"", ch); |
514 ch, cf->conf_file->file.name.data, | |
515 cf->conf_file->line); | |
516 return NGX_ERROR; | 491 return NGX_ERROR; |
517 } | 492 } |
518 | 493 |
519 if (ch == '{') { | 494 if (ch == '{') { |
520 return NGX_CONF_BLOCK_START; | 495 return NGX_CONF_BLOCK_START; |
522 | 497 |
523 return NGX_OK; | 498 return NGX_OK; |
524 | 499 |
525 case '}': | 500 case '}': |
526 if (cf->args->nelts != 0) { | 501 if (cf->args->nelts != 0) { |
527 ngx_log_error(NGX_LOG_EMERG, cf->log, 0, | 502 ngx_conf_log_error(NGX_LOG_EMERG, cf, 0, |
528 "unexpected \"}\" in %s:%ui", | 503 "unexpected \"}\""); |
529 cf->conf_file->file.name.data, | |
530 cf->conf_file->line); | |
531 return NGX_ERROR; | 504 return NGX_ERROR; |
532 } | 505 } |
533 | 506 |
534 return NGX_CONF_BLOCK_DONE; | 507 return NGX_CONF_BLOCK_DONE; |
535 | 508 |