Add the ability to dynamically specify weights for responses to DUNDi queries.
[asterisk/asterisk.git] / main / term.c
index e92a270..d051338 100644 (file)
@@ -43,7 +43,7 @@ ASTERISK_FILE_VERSION(__FILE__, "$Revision$")
 #include "asterisk/lock.h"
 #include "asterisk/utils.h"
 
-static int vt100compat = 0;
+static int vt100compat;
 
 static char prepdata[80] = "";
 static char enddata[80] = "";
@@ -264,33 +264,28 @@ char *term_prompt(char *outbuf, const char *inbuf, int maxout)
        return outbuf;
 }
 
-
 /* filter escape sequences */
 void term_filter_escapes(char *line)
- {
-        int i;
-   
-        for (i=0; i < strlen(line); i++) {
-                if (line[i] == ESC) {                                   
-                        if (line[i+1] == '\x5b') {
-                                switch (line[i+2]) {
-                                       case '\x30':
-                                                break;
-                                        case '\x31':
-                                                break;
-                                        case '\x33':
-                                                break;
-                                        default:
-                                                /* replace ESC with a space */
-                                                line[i] = ' ';
-                                }
-                        } else {
-                                /* replace ESC with a space */
-                                line[i] = ' ';
-                        }
-                } 
-        }
- }
+{
+       int i;
+       int len = strlen(line);
+
+       for (i = 0; i < len; i++) {
+               if (line[i] != ESC)
+                       continue;
+               if ((i < (len - 2)) &&
+                   (line[i + 1] == 0x5B)) {
+                       switch (line[i + 2]) {
+                       case 0x30:
+                       case 0x31:
+                       case 0x33:
+                               continue;
+                       }
+               }
+               /* replace ESC with a space */
+               line[i] = ' ';
+       }
+}
 
 char *term_prep(void)
 {