diff options
Diffstat (limited to 'src/expect/snprintf.c')
-rw-r--r-- | src/expect/snprintf.c | 33 |
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; +} |