comparison src/core/ngx_conf_file.c @ 2772:9b107cdf53f6

*) do not show line number for -g option *) reset configuration file after -g option has been parsed
author Igor Sysoev <igor@sysoev.ru>
date Tue, 28 Apr 2009 20:06:03 +0000
parents 6d358aeaa989
children d478379e51ac
comparison
equal deleted inserted replaced
2771:4d62ef39f08b 2772:9b107cdf53f6
59 59
60 60
61 char * 61 char *
62 ngx_conf_param(ngx_conf_t *cf) 62 ngx_conf_param(ngx_conf_t *cf)
63 { 63 {
64 char *rv;
64 ngx_str_t *param; 65 ngx_str_t *param;
65 ngx_buf_t b; 66 ngx_buf_t b;
66 ngx_conf_file_t conf_file; 67 ngx_conf_file_t conf_file;
67 68
68 param = &cf->cycle->conf_param; 69 param = &cf->cycle->conf_param;
80 b.last = param->data + param->len; 81 b.last = param->data + param->len;
81 b.end = b.last; 82 b.end = b.last;
82 b.temporary = 1; 83 b.temporary = 1;
83 84
84 conf_file.file.fd = NGX_INVALID_FILE; 85 conf_file.file.fd = NGX_INVALID_FILE;
85 conf_file.file.name.data = (u_char *) "command line"; 86 conf_file.file.name.data = NULL;
86 conf_file.line = 1; 87 conf_file.line = 0;
87 88
88 cf->conf_file = &conf_file; 89 cf->conf_file = &conf_file;
89 cf->conf_file->buffer = &b; 90 cf->conf_file->buffer = &b;
90 91
91 return ngx_conf_parse(cf, NULL); 92 rv = ngx_conf_parse(cf, NULL);
93
94 cf->conf_file = NULL;
95
96 return rv;
92 } 97 }
93 98
94 99
95 char * 100 char *
96 ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename) 101 ngx_conf_parse(ngx_conf_t *cf, ngx_str_t *filename)
971 if (cf->conf_file == NULL) { 976 if (cf->conf_file == NULL) {
972 ngx_log_error(level, cf->log, 0, "%*s", p - errstr, errstr); 977 ngx_log_error(level, cf->log, 0, "%*s", p - errstr, errstr);
973 return; 978 return;
974 } 979 }
975 980
981 if (cf->conf_file->file.fd == NGX_INVALID_FILE) {
982 ngx_log_error(level, cf->log, 0, "%*s in command line",
983 p - errstr, errstr);
984 return;
985 }
986
976 ngx_log_error(level, cf->log, 0, "%*s in %s:%ui", 987 ngx_log_error(level, cf->log, 0, "%*s in %s:%ui",
977 p - errstr, errstr, 988 p - errstr, errstr,
978 cf->conf_file->file.name.data, cf->conf_file->line); 989 cf->conf_file->file.name.data, cf->conf_file->line);
979 } 990 }
980 991