summaryrefslogtreecommitdiffstats
path: root/tests/syslog_inject.c
diff options
context:
space:
mode:
authorRainer Gerhards <rgerhards@adiscon.com>2011-02-22 16:10:21 +0100
committerRainer Gerhards <rgerhards@adiscon.com>2011-02-22 16:10:21 +0100
commit87bffff894a6ed82f126e6af33beaf53efb6b4c5 (patch)
treec2488d18bbc2830420902a52f250508715df1b38 /tests/syslog_inject.c
parentb7ee1de6b0dbdc67bbb239f44719fb4a50054fb5 (diff)
downloadrsyslog-87bffff894a6ed82f126e6af33beaf53efb6b4c5.tar.gz
rsyslog-87bffff894a6ed82f126e6af33beaf53efb6b4c5.tar.xz
rsyslog-87bffff894a6ed82f126e6af33beaf53efb6b4c5.zip
added one more test for imuxsock to autmatted test suite
control character escaping is now also being tested
Diffstat (limited to 'tests/syslog_inject.c')
-rw-r--r--tests/syslog_inject.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/syslog_inject.c b/tests/syslog_inject.c
new file mode 100644
index 00000000..a5d77b1a
--- /dev/null
+++ b/tests/syslog_inject.c
@@ -0,0 +1,28 @@
+/* This tool deliberately logs a message with the a trailing LF */
+/* Options:
+ * -l: inject linefeed at end of message
+ * -c: inject control character in middle of message
+ */
+#include <stdio.h>
+#include <stdlib.h>
+#include <syslog.h>
+#include <string.h>
+
+static inline void usage(void) {
+ fprintf(stderr, "Usage: syslog_inject [-l] [-c]\n");
+ exit(1);
+}
+
+int main(int argc, char *argv[])
+{
+ if(argc != 2)
+ usage();
+ if(!strcmp(argv[1], "-l"))
+ syslog(LOG_NOTICE, "test\n");
+ else if(!strcmp(argv[1], "-c"))
+ syslog(LOG_NOTICE, "test 1\t2");
+ else
+ usage();
+
+ return 0;
+}