summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--grammar/grammar.y8
-rw-r--r--grammar/rainerscript.c25
-rw-r--r--grammar/rainerscript.h1
3 files changed, 28 insertions, 6 deletions
diff --git a/grammar/grammar.y b/grammar/grammar.y
index f94cec04..db599c5b 100644
--- a/grammar/grammar.y
+++ b/grammar/grammar.y
@@ -161,12 +161,8 @@ block: stmt { $$ = $1; }
| '{' script '}' { $$ = $2; }
actlst: s_act { $$ = $1; }
| actlst '&' s_act { $$ = scriptAddStmt($1, $3); }
-s_act: BEGIN_ACTION nvlst ENDOBJ { $$ = cnfstmtNewAct($2);
- $$->printable="action()";
- dbgprintf("RRRR: action object\n"); }
- | LEGACY_ACTION { $$ = cnfstmtNew(S_ACT);
- $$->printable = (uchar*) $1;
- dbgprintf("RRRR: legacy action\n"); }
+s_act: BEGIN_ACTION nvlst ENDOBJ { $$ = cnfstmtNewAct($2); }
+ | LEGACY_ACTION { $$ = cnfstmtNewLegaAct($1); }
expr: expr AND expr { $$ = cnfexprNew(AND, $1, $3); }
| expr OR expr { $$ = cnfexprNew(OR, $1, $3); }
| NOT expr { $$ = cnfexprNew(NOT, NULL, $2); }
diff --git a/grammar/rainerscript.c b/grammar/rainerscript.c
index 6e3bae68..20cf2f6d 100644
--- a/grammar/rainerscript.c
+++ b/grammar/rainerscript.c
@@ -39,6 +39,7 @@
#include "rainerscript.h"
#include "conf.h"
#include "parserif.h"
+#include "rsconf.h"
#include "grammar.h"
#include "queue.h"
#include "srUtils.h"
@@ -1555,6 +1556,9 @@ cnfstmtPrint(struct cnfstmt *root, int indent)
//dbgprintf("stmt %p, indent %d, type '%c'\n", expr, indent, expr->nodetype);
for(stmt = root ; stmt != NULL ; stmt = stmt->next) {
switch(stmt->nodetype) {
+ case S_NOP:
+ doIndent(indent); dbgprintf("NOP\n");
+ break;
case S_STOP:
doIndent(indent); dbgprintf("STOP\n");
break;
@@ -1694,6 +1698,27 @@ cnfstmtNewAct(struct nvlst *lst)
done: return cnfstmt;
}
+struct cnfstmt *
+cnfstmtNewLegaAct(uchar *actline)
+{
+ struct cnfstmt* cnfstmt;
+ rsRetVal localRet;
+ if((cnfstmt = cnfstmtNew(S_ACT)) == NULL)
+ goto done;
+ cnfstmt->printable = (uchar*)strdup((char*)actline);
+ localRet = cflineDoAction(loadConf, &actline, &cnfstmt->d.act);
+ if(localRet != RS_RET_OK && localRet != RS_RET_OK_WARN) {
+ parser_errmsg("%s occured in file '%s' around line %d",
+ (localRet == RS_RET_OK_WARN) ? "warnings" : "errors",
+ cnfcurrfn, yylineno);
+ if(localRet != RS_RET_OK_WARN) {
+ cnfstmt->nodetype = S_NOP; /* disable action! */
+ goto done;
+ }
+ }
+done: return cnfstmt;
+}
+
struct cnfrule *
cnfruleNew(enum cnfFiltType filttype, struct cnfactlst *actlst)
{
diff --git a/grammar/rainerscript.h b/grammar/rainerscript.h
index 978f08ad..d69dd041 100644
--- a/grammar/rainerscript.h
+++ b/grammar/rainerscript.h
@@ -323,6 +323,7 @@ char *rmLeadingSpace(char *s);
struct cnfstmt * cnfstmtNewPRIFILT(char *prifilt, struct cnfstmt *t_then);
struct cnfstmt * cnfstmtNewPROPFILT(char *propfilt, struct cnfstmt *t_then);
struct cnfstmt * cnfstmtNewAct(struct nvlst *lst);
+struct cnfstmt * cnfstmtNewLegaAct(uchar *actline);
rsRetVal initRainerscript(void);
/* debug helper */