]> git.ipfire.org Git - thirdparty/nftables.git/commit
src: get rid of printf
authorPhil Sutter <phil@nwl.cc>
Thu, 28 Sep 2017 15:17:45 +0000 (17:17 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Fri, 29 Sep 2017 10:37:51 +0000 (12:37 +0200)
commit2535ba7006f22a6470f4c88ea7d30c343a1d8799
treee09697d8d9a59394170fa412276346d64b5b62e7
parent15a1f5bd55735f6f65a6fd9e2e86bb4a3f5ac815
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>
24 files changed:
include/datatype.h
include/expression.h
include/netlink.h
include/nftables.h
include/parser.h
include/rule.h
src/cli.c
src/ct.c
src/datatype.c
src/evaluate.c
src/expression.c
src/exthdr.c
src/fib.c
src/hash.c
src/main.c
src/meta.c
src/netlink.c
src/netlink_linearize.c
src/numgen.c
src/parser_bison.y
src/payload.c
src/rt.c
src/rule.c
src/statement.c