summaryrefslogtreecommitdiffstats
path: root/src/cli.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli.c')
-rw-r--r--src/cli.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/cli.c b/src/cli.c
index adffd6b9..a74411a0 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -92,6 +92,8 @@ static void cli_complete(char *line)
const HIST_ENTRY *hist;
const char *c;
LIST_HEAD(msgs);
+ int len;
+ char *s;
if (line == NULL) {
printf("\n");
@@ -119,6 +121,12 @@ static void cli_complete(char *line)
if (hist == NULL || strcmp(hist->line, line))
add_history(line);
+ len = strlen(line);
+ s = xmalloc(len + 2);
+ snprintf(s, len + 2, "%s\n", line);
+ xfree(line);
+ line = s;
+
parser_init(state, &msgs);
scanner_push_buffer(scanner, &indesc_cli, line);
nft_run(scanner, state, &msgs);