--- libaitcli/src/aitcli.c 2010/06/04 16:16:17 1.2.2.4 +++ libaitcli/src/aitcli.c 2010/06/07 09:04:46 1.2.2.5 @@ -3,7 +3,7 @@ * by Michael Pounov * * $Author: misho $ -* $Id: aitcli.c,v 1.2.2.4 2010/06/04 16:16:17 misho Exp $ +* $Id: aitcli.c,v 1.2.2.5 2010/06/07 09:04:46 misho Exp $ * *************************************************************************/ #include "global.h" @@ -1008,7 +1008,7 @@ recheck: break; } - if (code != RETCODE_ERR && buffer->line_buf) + if (code != RETCODE_ERR && code != RETCODE_EOF && buffer->line_buf) str = strdup(buffer->line_buf); return str; } @@ -1190,9 +1190,10 @@ cliLoop(linebuffer_t * __restrict buffer, const char * do { line = cliReadLine(buffer); - if (!line) + if (!line) { + printfNL(buffer, 0); break; - else + } else cli_addHistory(buffer, NULL); // clear whitespaces for (s = line; isspace(*s); s++); @@ -1214,8 +1215,9 @@ cliLoop(linebuffer_t * __restrict buffer, const char * else i++; } + if (!cmd) { - cli_Printf(buffer, "Command '%s' not found!\n", items[0]); + cli_Printf(buffer, "\nCommand '%s' not found!\n", items[0]); ret = -1; } else ret = cmd->cmd_func(buffer, i, items);