path: root/src/cli.c
diff options
authorPablo M. Bermudo Garay <>2017-06-23 18:38:24 +0200
committerPablo Neira Ayuso <>2017-06-26 18:57:03 +0200
commitf9d3e2e15b7ad968f30643ca6da55b75f03686fd (patch)
tree62209af9432b459d3a716d89c1cd6b9a4b82b7f0 /src/cli.c
parent8750c928cf2a250065a4a0e7948b961be3c46a52 (diff)
src: add new generic context structure nft_ctx
The new structure nft_ctx is meant to be used as a generic container of context information. This is a preparatory patch. So at the moment the struct just carry output_ctx on his path through main.c and cli.c. Based on original idea from Eric Leblond. Signed-off-by: Pablo M. Bermudo Garay <> Signed-off-by: Pablo Neira Ayuso <>
Diffstat (limited to 'src/cli.c')
1 files changed, 4 insertions, 4 deletions
diff --git a/src/cli.c b/src/cli.c
index c62e2a19..7cd2f45e 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -39,7 +39,7 @@ static const struct input_descriptor indesc_cli = {
static struct parser_state *state;
-static struct output_ctx cli_octx;
+static struct nft_ctx cli_nft;
static void *scanner;
static char histfile[PATH_MAX];
@@ -130,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, &cli_octx);
+ nft_run(&cli_nft, scanner, state, &msgs);
erec_print_list(stdout, &msgs);
@@ -168,11 +168,11 @@ void __fmtstring(1, 0) cli_display(const char *fmt, va_list ap)
-int cli_init(struct parser_state *_state, struct output_ctx *octx)
+int cli_init(struct nft_ctx *nft, struct parser_state *_state)
const char *home;
- cli_octx = *octx;
+ cli_nft = *nft;
rl_readline_name = "nft";
rl_instream = stdin;
rl_outstream = stdout;