summaryrefslogtreecommitdiffstats
path: root/grammar
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-07-22 18:03:43 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-07-22 18:03:43 +0200
commit9757aeb56445eee3aca2b43e6b3efa1f1cb59ba3 (patch)
treeb44dad3ab3f3477c4b6c45b615b60f5e51f58e35 /grammar
parent6b8b7ba0091a4e59b9a45057756fc7f754576242 (diff)
downloadrsyslog-9757aeb56445eee3aca2b43e6b3efa1f1cb59ba3.tar.gz
rsyslog-9757aeb56445eee3aca2b43e6b3efa1f1cb59ba3.tar.xz
rsyslog-9757aeb56445eee3aca2b43e6b3efa1f1cb59ba3.zip
milestone: queue object now has a param handler for new conf interface
... and action queue defs use this new interface (but not yet the main queues)
Diffstat (limited to 'grammar')
-rw-r--r--grammar/lexer.l21
-rw-r--r--grammar/parserif.h1
-rw-r--r--grammar/rainerscript.c29
3 files changed, 48 insertions, 3 deletions
diff --git a/grammar/lexer.l b/grammar/lexer.l
index cf912db3..f7691c4a 100644
--- a/grammar/lexer.l
+++ b/grammar/lexer.l
@@ -182,7 +182,7 @@ int fileno(FILE *stream);
<INOBJ>#.*$ /* skip comments in input */
<INOBJ>[ \n\t]
<INOBJ>. { dbgprintf("INOBJ: invalid char '%s'\n", yytext); }
-\$[a-z]+.*$ { /* see common on $IncludeConfig above */
+\$[a-z]+.*$ { /* see comment on $IncludeConfig above */
if(!strncasecmp(yytext, "$includeconfig ", 14)) {
yyless(14);
BEGIN INCL;
@@ -282,9 +282,17 @@ popfile(void)
if(bs == NULL)
return 1;
- /* delte current entry */
+ /* delete current entry. But we must not free the file name if
+ * this is the top-level file, because then it may still be used
+ * in error messages for other processing steps.
+ * TODO: change this to another method which stores the file
+ * name inside the config objects. In the longer term, this is
+ * necessary, as otherwise we may provide wrong file name information
+ * at the end of include files as well. -- rgerhards, 2011-07-22
+ */
yy_delete_buffer(bs->bs);
- free(bs->fn);
+ if(bs->prev != NULL)
+ free(bs->fn);
free(bs->estr);
/* switch back to previous */
@@ -299,3 +307,10 @@ popfile(void)
cnfcurrfn = currbs->fn;
return 0;
}
+
+void
+tellLexEndParsing(void)
+{
+ free(cnfcurrfn);
+ cnfcurrfn= NULL;
+}
diff --git a/grammar/parserif.h b/grammar/parserif.h
index adb0f42f..597cfe40 100644
--- a/grammar/parserif.h
+++ b/grammar/parserif.h
@@ -6,6 +6,7 @@ int yyparse();
char *cnfcurrfn;
void dbgprintf(char *fmt, ...) __attribute__((format(printf, 1, 2)));
void parser_errmsg(char *fmt, ...) __attribute__((format(printf, 1, 2)));
+void tellLexEndParsing(void);
extern int yydebug;
extern int yylineno;
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index fe99e4aa..1b44974c 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -35,9 +35,11 @@
#include <sys/stat.h>
#include <sys/types.h>
#include <libestr.h>
+#include "rsyslog.h"
#include "rainerscript.h"
#include "parserif.h"
#include "grammar.h"
+#include "queue.h"
#include "srUtils.h"
void
@@ -271,6 +273,30 @@ doGetBinary(struct nvlst *valnode, struct cnfparamdescr *param,
}
}
+static inline void
+doGetQueueType(struct nvlst *valnode, struct cnfparamdescr *param,
+ struct cnfparamvals *val)
+{
+ char *cstr;
+ if(!es_strcasebufcmp(valnode->val.d.estr, (uchar*)"fixedarray", 10)) {
+ val->val.d.n = QUEUETYPE_FIXED_ARRAY;
+ } else if(!es_strcasebufcmp(valnode->val.d.estr, (uchar*)"linkedlist", 10)) {
+ val->val.d.n = QUEUETYPE_LINKEDLIST;
+ } else if(!es_strcasebufcmp(valnode->val.d.estr, (uchar*)"disk", 4)) {
+ val->val.d.n = QUEUETYPE_DISK;
+ } else if(!es_strcasebufcmp(valnode->val.d.estr, (uchar*)"direct", 6)) {
+ val->val.d.n = QUEUETYPE_DIRECT;
+ } else {
+ cstr = es_str2cstr(valnode->val.d.estr, NULL);
+ parser_errmsg("param '%s': unknown queue type: '%s'",
+ param->name, cstr);
+ free(cstr);
+ }
+dbgprintf("XXXXX: queue type: %d\n", (int)val->val.d.n);
+ val->val.datatype = 'N';
+}
+
+
/* A file create-mode must be a four-digit octal number
* starting with '0'.
*/
@@ -416,6 +442,9 @@ nvlstGetParam(struct nvlst *valnode, struct cnfparamdescr *param,
valnode->bUsed = 1;
val->bUsed = 1;
switch(param->type) {
+ case eCmdHdlrQueueType:
+ doGetQueueType(valnode, param, val);
+ break;
case eCmdHdlrUID:
doGetUID(valnode, param, val);
break;