From 2535ba7006f22a6470f4c88ea7d30c343a1d8799 Mon Sep 17 00:00:00 2001 From: Phil Sutter Date: Thu, 28 Sep 2017 17:17:45 +0200 Subject: 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 Signed-off-by: Phil Sutter Signed-off-by: Pablo Neira Ayuso --- include/datatype.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/datatype.h') diff --git a/include/datatype.h b/include/datatype.h index 2e345910..e9f60798 100644 --- a/include/datatype.h +++ b/include/datatype.h @@ -209,7 +209,8 @@ extern void symbolic_constant_print(const struct symbol_table *tbl, struct output_ctx *octx); extern void symbol_table_print(const struct symbol_table *tbl, const struct datatype *dtype, - enum byteorder byteorder); + enum byteorder byteorder, + struct output_ctx *octx); extern struct symbol_table *rt_symbol_table_init(const char *filename); extern void rt_symbol_table_free(struct symbol_table *tbl); @@ -261,7 +262,7 @@ extern const struct datatype * set_datatype_alloc(const struct datatype *orig_dtype, unsigned int byteorder); extern void set_datatype_destroy(const struct datatype *dtype); -extern void time_print(uint64_t seconds); +extern void time_print(uint64_t seconds, struct output_ctx *octx); extern struct error_record *time_parse(const struct location *loc, const char *c, uint64_t *res); -- cgit v1.2.3