Skip to content

Commit

Permalink
guard CLICON_CLI_HIST_SIZE with CLIgen default
Browse files Browse the repository at this point in the history
  • Loading branch information
olofhagsand committed Mar 28, 2019
1 parent 772d939 commit 7ee4a15
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/cli/cli_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 7ee4a15

Please sign in to comment.