cli: print newline with ctrl-d with editline
Pablo Neira Ayuso
maintainerPATCH 1/1 cli: print newline with ctrl-d with editline
If user does not explicitly 'quit' then print a newline before going back to the shell.
Signed-off-by Pablo Neira Ayuso <[email protected]>
--- src/cli.c | 5 +++++ 1 file changed, 5 insertions(+)
src/cli.c +5 -0
@@ -38,6 +38,7 @@#define CMDLINE_QUIT "quit"static char histfile[PATH_MAX ]; +static bool quit;static void init_histfile (void )
@@ -140,6 +141,7 @@ static void cli_complete(char *line)return ;if (!strcmp (line,CMDLINE_QUIT )) { + quit = true;cli_exit ();exit (0 ); }
@@ -221,6 +223,9 @@ void cli_exit(void) {rl_deprep_terminal ();write_history (histfile); +/* Print \n when user exits via ^D */ +if (!quit) +printf ("\n" ); }#else /* HAVE_LINENOISE */
Signature · 1 line
2.30.2