From 7ee4a151cf71484db2cd18462c625cfb57d070ed Mon Sep 17 00:00:00 2001 From: Olof Hagsand Date: Thu, 28 Mar 2019 09:19:43 +0100 Subject: [PATCH] guard CLICON_CLI_HIST_SIZE with CLIgen default --- apps/cli/cli_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/apps/cli/cli_main.c b/apps/cli/cli_main.c index 66c3dd75..3e8f413e 100644 --- a/apps/cli/cli_main.c +++ b/apps/cli/cli_main.c @@ -86,7 +86,11 @@ cli_history_load(clicon_handle h) FILE *f = NULL; wordexp_t result = {0,}; /* for tilde expansion */ - lines = clicon_option_int(h,"CLICON_CLI_HIST_SIZE"); + /* Get history size from clixon option, if not use cligen default. */ + if (clicon_option_exists(h, "CLICON_CLI_HIST_SIZE")) + lines = clicon_option_int(h,"CLICON_CLI_HIST_SIZE"); + else + lines = CLIGEN_HISTSIZE_DEFAULT; /* Re-init history with clixon lines (1st time was w cligen defaults) */ if (cligen_hist_init(cli_cligen(h), lines) < 0) goto done;