summaryrefslogtreecommitdiffstats
path: root/src/cli.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-09-28 17:17:45 +0200
committerPablo Neira Ayuso <pablo@netfilter.org>2017-09-29 12:37:51 +0200
commit2535ba7006f22a6470f4c88ea7d30c343a1d8799 (patch)
treee09697d8d9a59394170fa412276346d64b5b62e7 /src/cli.c
parent15a1f5bd55735f6f65a6fd9e2e86bb4a3f5ac815 (diff)
src: get rid of printf
This patch introduces nft_print()/nft_gmp_print() functions which have to be used instead of printf to output information that were previously send to stdout. These functions print to a FILE pointer defined in struct output_ctx. It is set by calling: | old_fp = nft_ctx_set_output(ctx, new_fp); Having an application-defined FILE pointer is actually quite flexible: Using fmemopen() or even fopencookie(), an application gains full control over what is printed and where it should go to. Signed-off-by: Eric Leblond <eric@regit.org> Signed-off-by: Phil Sutter <phil@nwl.cc> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/cli.c b/src/cli.c
index d923ff7d..692d1731 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -135,7 +135,7 @@ static void cli_complete(char *line)
line = s;
parser_init(cli_nf_sock, &cli_nft->cache, state, &msgs,
- cli_nft->debug_mask);
+ cli_nft->debug_mask, &cli_nft->output);
scanner_push_buffer(scanner, &indesc_cli, line);
nft_run(cli_nft, cli_nf_sock, scanner, state, &msgs);
erec_print_list(stdout, &msgs, cli_nft->debug_mask);