summaryrefslogtreecommitdiffstats
path: root/grammar
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-07-09 18:31:50 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-07-09 18:31:50 +0200
commit5e2b03a31c312e6cd6a7f4cb0bca1f062668dc52 (patch)
treed12b9640e8f705cfa8b3f15506a30135c81c3f44 /grammar
parent6ebf9ada253ffd8c88cbe84a46fd5aa3bfd58367 (diff)
downloadrsyslog-5e2b03a31c312e6cd6a7f4cb0bca1f062668dc52.tar.gz
rsyslog-5e2b03a31c312e6cd6a7f4cb0bca1f062668dc52.tar.xz
rsyslog-5e2b03a31c312e6cd6a7f4cb0bca1f062668dc52.zip
cleaup & emergency config system reactivated
Diffstat (limited to 'grammar')
-rw-r--r--grammar/lexer.l23
-rw-r--r--grammar/rainerscript.h1
2 files changed, 24 insertions, 0 deletions
diff --git a/grammar/lexer.l b/grammar/lexer.l
index 316b2a65..64a804fa 100644
--- a/grammar/lexer.l
+++ b/grammar/lexer.l
@@ -198,6 +198,29 @@ int fileno(FILE *stream);
<<EOF>> { if(popfile() != 0) yyterminate(); }
%%
+int
+cnfParseBuffer(char *buf, unsigned lenBuf)
+{
+ struct bufstack *bs;
+ int r = 0;
+ /* maintain stack */
+ if((bs = malloc(sizeof(struct bufstack))) == NULL) {
+ r = 1;
+ goto done;
+ }
+
+ if(currbs != NULL)
+ currbs->lineno = yylineno;
+ bs->prev = currbs;
+ bs->fn = strdup("*buffer*");
+ bs->bs = yy_scan_buffer(buf, lenBuf);
+ bs->estr = NULL;
+ currbs = bs;
+ currfn = bs->fn;
+ yylineno = 1;
+done: return r;
+}
+
/* set a new buffers. Returns 0 on success, something else otherwise. */
int
cnfSetLexFile(char *fname)
diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h
index 75bb782d..62c2aa50 100644
--- a/grammar/rainerscript.h
+++ b/grammar/rainerscript.h
@@ -166,6 +166,7 @@ struct exprret {
};
+int cnfParseBuffer(char *buf, unsigned lenBuf);
void readConfFile(FILE *fp, es_str_t **str);
struct nvlst* nvlstNew(es_str_t *name, es_str_t *value);
void nvlstDestruct(struct nvlst *lst);