From: Tilghman Lesher Date: Tue, 1 Jun 2010 15:17:46 +0000 (+0000) Subject: Prevent CLI prompt from distorting output of lines shorter than the prompt. X-Git-Tag: 1.4.33-rc1~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f703a2d7fa15abe9586dff752e488f8c790e78f9;p=thirdparty%2Fasterisk.git Prevent CLI prompt from distorting output of lines shorter than the prompt. Uses the VT100 method of clearing the line from the cursor position to the end of the line: Esc-0K (closes issue #17160) Reported by: coolmig Patches: 20100531__issue17160.diff.txt uploaded by tilghman (license 14) Tested by: coolmig git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/1.4@266585 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- diff --git a/main/asterisk.c b/main/asterisk.c index 236e6318b2..0e1306fd8d 100644 --- a/main/asterisk.c +++ b/main/asterisk.c @@ -1863,7 +1863,7 @@ static int ast_el_read_char(EditLine *el, char *cp) /* Write over the CLI prompt */ if (!ast_opt_exec && !lastpos) { - if (write(STDOUT_FILENO, "\r", 1) < 0) { + if (write(STDOUT_FILENO, "\r", 5) < 0) { } } if (write(STDOUT_FILENO, buf, res) < 0) {