Merged revisions 117899 via svnmerge from
authorTilghman Lesher <tilghman@meg.abyt.es>
Thu, 22 May 2008 18:54:41 +0000 (18:54 +0000)
committerTilghman Lesher <tilghman@meg.abyt.es>
Thu, 22 May 2008 18:54:41 +0000 (18:54 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r117899 | tilghman | 2008-05-22 13:53:53 -0500 (Thu, 22 May 2008) | 2 lines

Also remove preamble from asynchronous events (reported by jsmith on #asterisk-dev)

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@117900 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/asterisk.c

index d28e556..a6bc0e4 100644 (file)
@@ -1907,6 +1907,7 @@ static int ast_el_read_char(EditLine *el, char *cp)
                                return (num_read);
                }
                if (fds[0].revents) {
+                       char *tmp;
                        res = read(ast_consock, buf, sizeof(buf) - 1);
                        /* if the remote side disappears exit */
                        if (res < 1) {
@@ -1939,6 +1940,14 @@ static int ast_el_read_char(EditLine *el, char *cp)
 
                        buf[res] = '\0';
 
+                       /* Strip preamble from asynchronous events, too */
+                       for (tmp = buf; *tmp; tmp++) {
+                               if (*tmp == 127) {
+                                       memmove(tmp, tmp + 1, strlen(tmp));
+                                       tmp--;
+                               }
+                       }
+
                        /* Write over the CLI prompt */
                        if (!ast_opt_exec && !lastpos)
                                write(STDOUT_FILENO, "\r", 1);