From 35f6cd327c2ec46296adf464f981cd6cddfec27b Mon Sep 17 00:00:00 2001 From: Varsha Rao Date: Fri, 16 Jun 2017 14:54:06 +0530 Subject: src: Pass stateless, numeric, ip2name and handle variables as structure members. libnftables library will be created soon. So declare numeric_output, stateless_output, ip2name_output and handle_output as members of structure output_ctx, instead of global variables. Rename these variables as following, numeric_output -> numeric stateless_output -> stateless ip2name_output -> ip2name handle_output -> handle Also add struct output_ctx *octx as member of struct netlink_ctx. Signed-off-by: Varsha Rao Signed-off-by: Pablo Neira Ayuso --- src/cli.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/cli.c') diff --git a/src/cli.c b/src/cli.c index a74411a0..c62e2a19 100644 --- a/src/cli.c +++ b/src/cli.c @@ -39,6 +39,7 @@ static const struct input_descriptor indesc_cli = { }; static struct parser_state *state; +static struct output_ctx cli_octx; static void *scanner; static char histfile[PATH_MAX]; @@ -129,7 +130,7 @@ static void cli_complete(char *line) parser_init(state, &msgs); scanner_push_buffer(scanner, &indesc_cli, line); - nft_run(scanner, state, &msgs); + nft_run(scanner, state, &msgs, &cli_octx); erec_print_list(stdout, &msgs); xfree(line); cache_release(); @@ -167,10 +168,11 @@ void __fmtstring(1, 0) cli_display(const char *fmt, va_list ap) rl_forced_update_display(); } -int cli_init(struct parser_state *_state) +int cli_init(struct parser_state *_state, struct output_ctx *octx) { const char *home; + cli_octx = *octx; rl_readline_name = "nft"; rl_instream = stdin; rl_outstream = stdout; -- cgit v1.2.3