Index: asterisk.c =================================================================== RCS file: /usr/cvsroot/asterisk/asterisk.c,v retrieving revision 1.160 diff -u -r1.160 asterisk.c --- asterisk.c 6 Jun 2005 03:04:58 -0000 1.160 +++ asterisk.c 9 Sep 2005 02:41:07 -0000 @@ -127,6 +127,7 @@ static int ast_el_add_history(char *); static int ast_el_read_history(char *); static int ast_el_write_history(char *); +static void cli_unprompt(void); char ast_config_AST_CONFIG_DIR[AST_CONFIG_MAX_PATH]; char ast_config_AST_CONFIG_FILE[AST_CONFIG_MAX_PATH]; @@ -1002,7 +1003,7 @@ buf[res] = '\0'; if (!option_exec && !lastpos) - write(STDOUT_FILENO, "\r", 1); + cli_unprompt(); write(STDOUT_FILENO, buf, res); if ((buf[res-1] == '\n') || (buf[res-2] == '\n')) { *cp = CC_REFRESH; @@ -1162,6 +1163,18 @@ return(prompt); } +static void cli_unprompt(void) +{ + static char prompt[203]; + int promptlen; + memset(prompt, ' ', sizeof(prompt)); + prompt[0] = '\r'; + promptlen = strlen(cli_prompt(NULL)); + prompt[promptlen+1] = '\r'; + prompt[promptlen+2] = 0; + write(STDOUT_FILENO, prompt, promptlen+2); +} + static char **ast_el_strtoarr(char *buf) { char **match_list = NULL, *retstr;