summaryrefslogtreecommitdiff
path: root/src/configparser.y
diff options
context:
space:
mode:
authorJan Kneschke <jan@kneschke.de>2005-04-14 21:20:29 +0000
committerJan Kneschke <jan@kneschke.de>2005-04-14 21:20:29 +0000
commit4f14ff8424ed887106090e038c9a343116b27031 (patch)
tree7ffc691892e2427ad9db253e44cae1a2ff6d0dd3 /src/configparser.y
parentea73c9e5128bba815f1212fdca48727e5e33b661 (diff)
downloadlighttpd-git-4f14ff8424ed887106090e038c9a343116b27031.tar.gz
merge [109], [259], [266] and [267]
git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@277 152afb58-edef-0310-8abb-c4023f1b3aa9
Diffstat (limited to 'src/configparser.y')
-rw-r--r--src/configparser.y20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/configparser.y b/src/configparser.y
index 3d424ce3..306e5f4d 100644
--- a/src/configparser.y
+++ b/src/configparser.y
@@ -5,6 +5,7 @@
%include {
#include <assert.h>
+#include <stdio.h>
#include "config.h"
#include "configfile.h"
#include "buffer.h"
@@ -31,7 +32,14 @@ metaline ::= EOL.
varline ::= key(A) ASSIGN value(B). {
buffer_copy_string_buffer(B->key, A);
- array_insert_unique(ctx->ctx_config, B);
+ if (NULL == array_get_element(ctx->ctx_config, B->key->ptr)) {
+ array_insert_unique(ctx->ctx_config, B);
+ } else {
+ fprintf(stderr, "Duplicate config variable in conditional %s: %s\n",
+ ctx->ctx_name->ptr, B->key->ptr);
+ ctx->ok = 0;
+ B->free(B);
+ }
buffer_free(A);
}
@@ -62,7 +70,15 @@ array(A) ::= LPARAN aelements(B) RPARAN. {
}
aelements(A) ::= aelements(C) COMMA aelement(B). {
- array_insert_unique(C, B);
+ if (buffer_is_empty(B->key) ||
+ NULL == array_get_element(C, B->key->ptr)) {
+ array_insert_unique(C, B);
+ } else {
+ fprintf(stderr, "Duplicate array-key: %s\n",
+ B->key->ptr);
+ B->free(B);
+ ctx->ok = 0;
+ }
A = C;
}