--- libaitcli/src/aitcli.c 2024/10/29 01:00:09 1.19.4.2 +++ libaitcli/src/aitcli.c 2025/12/17 23:29:37 1.19.4.3 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitcli.c,v 1.19.4.2 2024/10/29 01:00:09 misho Exp $ +* $Id: aitcli.c,v 1.19.4.3 2025/12/17 23:29:37 misho Exp $ * ************************************************************************** The ELWIX and AITNET software is distributed under the following @@ -12,7 +12,7 @@ terms: All of the documentation and software included in the ELWIX and AITNET Releases is copyrighted by ELWIX - Sofia/Bulgaria -Copyright 2004 - 2024 +Copyright 2004 - 2025 by Michael Pounov . All rights reserved. Redistribution and use in source and binary forms, with or without @@ -186,12 +186,18 @@ bufEOL(int idx, void * __restrict cli_buffer) static int bufEOF(int idx, void * __restrict cli_buffer) { + int ret; + /* if (!cli_buffer || idx < 0 || idx > MAX_BINDKEY) return RETCODE_ERR; */ - return RETCODE_EOF; + printfNL(cli_buffer, 0); + ret = cli_Cmd_End(cli_buffer, idx, NULL); + printfCR(cli_buffer, (ret != RETCODE_EOF)); + + return ret; } static int @@ -520,6 +526,7 @@ static int bufEndNode(int idx, void * __restrict cli_buffer) { linebuffer_t *buf = cli_buffer; + char szPrompt[STRSIZ + 16] = {[0 ... STRSIZ + 15] = 0}; if (!cli_buffer || idx < 0 || idx > MAX_BINDKEY) return RETCODE_ERR; @@ -527,6 +534,8 @@ bufEndNode(int idx, void * __restrict cli_buffer) if (buf->line_level > 0) { printfNL(cli_buffer, 0); buf->line_level--; + snprintf(szPrompt, sizeof szPrompt, "%s{%d}> ", buf->line_porigin, buf->line_level); + cli_setPrompt(buf, szPrompt); cli_Printf(buf, "Enter to config level %d\n", buf->line_level); } @@ -558,6 +567,8 @@ cli_Printf(linebuffer_t * __restrict cli_buffer, char va_start(lst, fmt); vfprintf(f, fmt, lst); va_end(lst); + + fclose(f); } else cli_SetErr(EINVAL, "Invalid input parameters ..."); }