diff options
Diffstat (limited to 'src/print.c')
-rw-r--r-- | src/print.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/print.c b/src/print.c new file mode 100644 index 0000000..8aefa96 --- /dev/null +++ b/src/print.c @@ -0,0 +1,39 @@ +/* + * 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 (or any + * later) as published by the Free Software Foundation. + */ + +#include <nft.h> + +#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; +} |