aboutsummaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2002-12-23 18:22:18 +0000
committerIgor Sysoev <igor@sysoev.ru>2002-12-23 18:22:18 +0000
commit295bb6335d2f0b1931dbd0ff93de87fad189e9a7 (patch)
treebcfe25f469f7c68b45bdf7b6863160f2b40a4a91 /src/core
parenta6717c4e59a24bb11dab29b12fb9851bb41293c0 (diff)
downloadnginx-295bb6335d2f0b1931dbd0ff93de87fad189e9a7.tar.gz
nginx-295bb6335d2f0b1931dbd0ff93de87fad189e9a7.zip
nginx-0.0.1-2002-12-23-21:22:18 import
Diffstat (limited to 'src/core')
-rw-r--r--src/core/ngx_config.h9
-rw-r--r--src/core/ngx_config_file.c38
2 files changed, 26 insertions, 21 deletions
diff --git a/src/core/ngx_config.h b/src/core/ngx_config.h
index f3eb11652..51d59dac1 100644
--- a/src/core/ngx_config.h
+++ b/src/core/ngx_config.h
@@ -67,12 +67,14 @@
#define HAVE_INHERITED_NONBLOCK 1
#endif
+#include <sys/stropts.h> /* INFTIM */
+
#endif /* Solaris */
#include <unistd.h>
-#include <stddef.h> /* offsetof */
+#include <stddef.h> /* offsetof */
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
@@ -90,6 +92,11 @@
#ifndef HAVE_POLL
#define HAVE_POLL 1
#include <poll.h>
+/*
+#ifndef INFTIM
+#define INFTIM -1
+#endif
+*/
#endif
#define ngx_inline inline
diff --git a/src/core/ngx_config_file.c b/src/core/ngx_config_file.c
index 80252e864..0feb21c45 100644
--- a/src/core/ngx_config_file.c
+++ b/src/core/ngx_config_file.c
@@ -179,15 +179,15 @@ int ngx_conf_read_token(ngx_conf_t *cf)
found = 0;
need_space = 0;
last_space = 1;
- len = 0;
quoted = s_quoted = d_quoted = 0;
cf->args->nelts = 0;
h = cf->conf_file->hunk;
+ start = h->pos.mem;
ngx_log_debug(cf->log, "TOKEN START");
- for (start = h->pos.mem; /* void */ ; /* void */) {
+ for ( ;; ) {
if (h->pos.mem >= h->last.mem) {
if (cf->conf_file->file.offset
@@ -215,14 +215,21 @@ ngx_log_debug(cf->log, "TOKEN START");
ch = *h->pos.mem++;
+#if 0
ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _
last_space _ need_space _
quoted _ s_quoted _ d_quoted _ ch);
+#endif
if (ch == LF) {
cf->conf_file->line++;
}
+ if (quoted) {
+ quoted = 0;
+ continue;
+ }
+
if (need_space) {
if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
last_space = 1;
@@ -237,16 +244,8 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _
return NGX_ERROR;
}
- if (quoted) {
- quoted = 0;
- continue;
- }
-
- len++;
-
if (last_space) {
if (ch == ' ' || ch == '\t' || ch == CR || ch == LF) {
- len = 0;
continue;
}
@@ -254,6 +253,10 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _
switch (ch) {
+ case ';':
+ case '{':
+ return NGX_OK;
+
case '\\':
quoted = 1;
last_space = 0;
@@ -261,14 +264,12 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _
case '"':
start++;
- len--;
d_quoted = 1;
last_space = 0;
continue;
case '\'':
start++;
- len--;
s_quoted = 1;
last_space = 0;
continue;
@@ -285,7 +286,6 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _
if (d_quoted) {
if (ch == '"') {
- len--;
d_quoted = 0;
need_space = 1;
found = 1;
@@ -293,7 +293,6 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _
} else if (s_quoted) {
if (ch == '\'') {
- len--;
s_quoted = 0;
need_space = 1;
found = 1;
@@ -301,20 +300,19 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _
} else if (ch == ' ' || ch == '\t' || ch == CR || ch == LF
|| ch == ';' || ch == '{') {
- len--;
last_space = 1;
found = 1;
}
if (found) {
ngx_test_null(word, ngx_push_array(cf->args), NGX_ERROR);
- ngx_test_null(word->data, ngx_palloc(cf->pool, len + 1),
+ ngx_test_null(word->data,
+ ngx_palloc(cf->pool, h->pos.mem - start + 1),
NGX_ERROR);
- word->len = len;
- for (dst = word->data, src = start;
+ for (dst = word->data, src = start, len = 0;
src < h->pos.mem - 1;
- /* void */)
+ len++)
{
if (*src == '\\') {
src++;
@@ -322,6 +320,7 @@ ngx_log_debug(cf->log, "%d:%d:%d:%d:%d '%c'" _
*dst++ = *src++;
}
*dst = '\0';
+ word->len = len;
ngx_log_debug(cf->log, "FOUND %d:'%s'" _ word->len _ word->data);
@@ -330,7 +329,6 @@ ngx_log_debug(cf->log, "FOUND %d:'%s'" _ word->len _ word->data);
}
found = 0;
- len = 0;
}
}
}