summaryrefslogtreecommitdiffstats
path: root/grammar/testdriver.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-07-05 12:33:48 +0200
committerRainer Gerhards <rgerhards@adiscon.com>2011-07-05 12:33:48 +0200
commitf8e7c7e3656085bee11b1667f32828dfb4e3df06 (patch)
treea70921c7ae31d4174c7c166a05619f4506a7e62f /grammar/testdriver.c
parent6175ce90b59d742976aa5a8b2603902761e540ae (diff)
downloadrsyslog-f8e7c7e3656085bee11b1667f32828dfb4e3df06.tar.gz
rsyslog-f8e7c7e3656085bee11b1667f32828dfb4e3df06.tar.xz
rsyslog-f8e7c7e3656085bee11b1667f32828dfb4e3df06.zip
milestone: some plumbing for rsyslog/stand alone parsing
Diffstat (limited to 'grammar/testdriver.c')
-rw-r--r--grammar/testdriver.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/grammar/testdriver.c b/grammar/testdriver.c
index e1623829..915b5942 100644
--- a/grammar/testdriver.c
+++ b/grammar/testdriver.c
@@ -24,9 +24,39 @@
#include "config.h"
#include <stdio.h>
#include <stdlib.h>
+#include <stdarg.h>
#include <libestr.h>
#include "parserif.h"
+extern int yylineno;
+
+void
+parser_errmsg(char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ printf("error on or before line %d: ", yylineno);
+ vprintf(fmt, ap);
+ printf("\n");
+ va_end(ap);
+}
+
+int
+yyerror(char *s)
+{
+ parser_errmsg("%s", s);
+ return 0;
+}
+
+void
+dbgprintf(char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ vfprintf(stdout, fmt, ap);
+ va_end(ap);
+}
+
void
cstrPrint(char *text, es_str_t *estr)
{