summaryrefslogtreecommitdiffstats
path: root/src/expect/snprintf.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2007-05-01 18:30:03 +0000
committer/C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org </C=EU/ST=EU/CN=Pablo Neira Ayuso/emailAddress=pablo@netfilter.org>2007-05-01 18:30:03 +0000
commit4db878d6f81fd64029c48003f4e1ae57069a7c65 (patch)
treeb15b1aa433fdd9284fed8db9a02a19b8d1aa46a0 /src/expect/snprintf.c
parent7736631fef63efde9c0fd68af89c3e2900286428 (diff)
introduce the new expectation API
Diffstat (limited to 'src/expect/snprintf.c')
-rw-r--r--src/expect/snprintf.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/expect/snprintf.c b/src/expect/snprintf.c
new file mode 100644
index 0000000..b981625
--- /dev/null
+++ b/src/expect/snprintf.c
@@ -0,0 +1,33 @@
+/*
+ * (C) 2006-2007 by Pablo Neira Ayuso <pablo@netfilter.org>
+ *
+ * This software may be used and distributed according to the terms
+ * of the GNU General Public License, incorporated herein by reference.
+ */
+
+#include "internal.h"
+
+int __snprintf_expect(char *buf,
+ unsigned int len,
+ const struct nf_expect *exp,
+ unsigned int type,
+ unsigned int msg_output,
+ unsigned int flags)
+{
+ int size;
+
+ switch(msg_output) {
+ case NFCT_O_DEFAULT:
+ size = __snprintf_expect_default(buf, len, exp, type, flags);
+ break;
+ default:
+ errno = ENOENT;
+ return -1;
+ }
+
+ /* NULL terminated string */
+ if (snprintf(buf+size, len-size, "\0") == -1)
+ return -1;
+
+ return size;
+}