summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/libnftables.c27
-rw-r--r--src/print.c38
3 files changed, 39 insertions, 27 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index fd641755..a1c18fe2 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -62,6 +62,7 @@ libnftables_la_SOURCES = \
nfnl_osf.c \
tcpopt.c \
socket.c \
+ print.c \
libnftables.c
# yacc and lex generate dirty code
diff --git a/src/libnftables.c b/src/libnftables.c
index dccb8ab4..f2cd267d 100644
--- a/src/libnftables.c
+++ b/src/libnftables.c
@@ -507,30 +507,3 @@ err:
cache_release(&nft->cache);
return rc;
}
-
-int nft_print(struct output_ctx *octx, const char *fmt, ...)
-{
- int ret;
- va_list arg;
-
- va_start(arg, fmt);
- ret = vfprintf(octx->output_fp, fmt, arg);
- va_end(arg);
- fflush(octx->output_fp);
-
- return ret;
-}
-
-int nft_gmp_print(struct output_ctx *octx, const char *fmt, ...)
-{
- int ret;
- va_list arg;
-
- va_start(arg, fmt);
- ret = gmp_vfprintf(octx->output_fp, fmt, arg);
- va_end(arg);
- fflush(octx->output_fp);
-
- return ret;
-}
-
diff --git a/src/print.c b/src/print.c
new file mode 100644
index 00000000..d1b25e8b
--- /dev/null
+++ b/src/print.c
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017 Phil Sutter <phil@nwl.cc>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ *
+ */
+
+#include <stdarg.h>
+#include <nftables.h>
+#include <utils.h>
+
+int nft_print(struct output_ctx *octx, const char *fmt, ...)
+{
+ int ret;
+ va_list arg;
+
+ va_start(arg, fmt);
+ ret = vfprintf(octx->output_fp, fmt, arg);
+ va_end(arg);
+ fflush(octx->output_fp);
+
+ return ret;
+}
+
+int nft_gmp_print(struct output_ctx *octx, const char *fmt, ...)
+{
+ int ret;
+ va_list arg;
+
+ va_start(arg, fmt);
+ ret = gmp_vfprintf(octx->output_fp, fmt, arg);
+ va_end(arg);
+ fflush(octx->output_fp);
+
+ return ret;
+}