--- libaitcli/src/aitcli.c 2013/10/08 11:30:00 1.8.2.7 +++ libaitcli/src/aitcli.c 2013/10/08 12:04:42 1.9 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitcli.c,v 1.8.2.7 2013/10/08 11:30:00 misho Exp $ +* $Id: aitcli.c,v 1.9 2013/10/08 12:04:42 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -506,7 +506,24 @@ bufHelp(int idx, void * __restrict cli_buffer) return RETCODE_OK; } +static int +bufEndNode(int idx, void * __restrict cli_buffer) +{ + linebuffer_t *buf = cli_buffer; + if (!cli_buffer || idx < 0 || idx > MAX_BINDKEY) + return RETCODE_ERR; + + if (buf->line_level > 0) { + printfNL(cli_buffer, 0); + buf->line_level--; + cli_Printf(buf, "Enter to config level %d\n", buf->line_level); + } + + return bufCLR(idx, cli_buffer); +} + + /* * cli_Printf() - Send message to CLI session * @@ -1041,6 +1058,8 @@ cliInit(int fin, int fout, const char *prompt) keys[i].key_func = bufEND; if (cli_buffer->line_prompt && i == *K_TAB) keys[i].key_func = bufComp; + if (cli_buffer->line_prompt && i == *K_CTRL_Z) + keys[i].key_func = bufEndNode; if (i >= *K_SPACE && i < *K_BACKSPACE) keys[i].key_func = bufCHAR; if (i > *K_BACKSPACE && i < 0xff)