Mercurial > hg > nginx
comparison src/core/ngx_conf_file.c @ 67:5a7d1aaa1618
nginx-0.0.1-2003-03-11-23:38:13 import
author | Igor Sysoev <igor@sysoev.ru> |
---|---|
date | Tue, 11 Mar 2003 20:38:13 +0000 |
parents | 34d647deb1da |
children | 59229033ae93 |
comparison
equal
deleted
inserted
replaced
66:4876cd4a36bb | 67:5a7d1aaa1618 |
---|---|
204 sharp_comment = 0; | 204 sharp_comment = 0; |
205 quoted = s_quoted = d_quoted = 0; | 205 quoted = s_quoted = d_quoted = 0; |
206 | 206 |
207 cf->args->nelts = 0; | 207 cf->args->nelts = 0; |
208 h = cf->conf_file->hunk; | 208 h = cf->conf_file->hunk; |
209 start = h->pos.mem; | 209 start = h->pos; |
210 | 210 |
211 #if 0 | 211 #if 0 |
212 ngx_log_debug(cf->log, "TOKEN START"); | 212 ngx_log_debug(cf->log, "TOKEN START"); |
213 #endif | 213 #endif |
214 | 214 |
215 for ( ;; ) { | 215 for ( ;; ) { |
216 | 216 |
217 if (h->pos.mem >= h->last.mem) { | 217 if (h->pos >= h->last) { |
218 if (cf->conf_file->file.offset | 218 if (cf->conf_file->file.offset |
219 >= ngx_file_size(cf->conf_file->file.info)) { | 219 >= ngx_file_size(cf->conf_file->file.info)) { |
220 return NGX_CONF_FILE_DONE; | 220 return NGX_CONF_FILE_DONE; |
221 } | 221 } |
222 | 222 |
223 if (h->pos.mem - start) { | 223 if (h->pos - start) { |
224 ngx_memcpy(h->start, start, h->pos.mem - start); | 224 ngx_memcpy(h->start, start, h->pos - start); |
225 } | 225 } |
226 | 226 |
227 n = ngx_read_file(&cf->conf_file->file, | 227 n = ngx_read_file(&cf->conf_file->file, |
228 h->start + (h->pos.mem - start), | 228 h->start + (h->pos - start), |
229 h->end - (h->start + (h->pos.mem - start)), | 229 h->end - (h->start + (h->pos - start)), |
230 cf->conf_file->file.offset); | 230 cf->conf_file->file.offset); |
231 | 231 |
232 if (n == NGX_ERROR) { | 232 if (n == NGX_ERROR) { |
233 return NGX_ERROR; | 233 return NGX_ERROR; |
234 } | 234 } |
235 | 235 |
236 h->pos.mem = h->start + (h->pos.mem - start); | 236 h->pos = h->start + (h->pos - start); |
237 start = h->start; | 237 start = h->start; |
238 h->last.mem = h->pos.mem + n; | 238 h->last = h->pos + n; |
239 } | 239 } |
240 | 240 |
241 ch = *h->pos.mem++; | 241 ch = *h->pos++; |
242 | 242 |
243 #if 0 | 243 #if 0 |
244 ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _ | 244 ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _ |
245 last_space _ need_space _ | 245 last_space _ need_space _ |
246 quoted _ s_quoted _ d_quoted _ ch); | 246 quoted _ s_quoted _ d_quoted _ ch); |
280 if (last_space) { | 280 if (last_space) { |
281 if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) { | 281 if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) { |
282 continue; | 282 continue; |
283 } | 283 } |
284 | 284 |
285 start = h->pos.mem - 1; | 285 start = h->pos - 1; |
286 | 286 |
287 switch (ch) { | 287 switch (ch) { |
288 | 288 |
289 case ';': | 289 case ';': |
290 case '{': | 290 case '{': |
361 } | 361 } |
362 | 362 |
363 if (found) { | 363 if (found) { |
364 ngx_test_null(word, ngx_push_array(cf->args), NGX_ERROR); | 364 ngx_test_null(word, ngx_push_array(cf->args), NGX_ERROR); |
365 ngx_test_null(word->data, | 365 ngx_test_null(word->data, |
366 ngx_palloc(cf->pool, h->pos.mem - start + 1), | 366 ngx_palloc(cf->pool, h->pos - start + 1), |
367 NGX_ERROR); | 367 NGX_ERROR); |
368 | 368 |
369 for (dst = word->data, src = start, len = 0; | 369 for (dst = word->data, src = start, len = 0; |
370 src < h->pos.mem - 1; | 370 src < h->pos - 1; |
371 len++) | 371 len++) |
372 { | 372 { |
373 if (*src == '\\') { | 373 if (*src == '\\') { |
374 src++; | 374 src++; |
375 } | 375 } |