diff options
author | Matt O'Gorman <mogorman@digium.com> | 2006-11-11 02:12:27 +0000 |
---|---|---|
committer | Matt O'Gorman <mogorman@digium.com> | 2006-11-11 02:12:27 +0000 |
commit | b02570228737f8db4ca664f65e65bf8cb686c230 (patch) | |
tree | 5253b808f2c774a7576514283606b636a2562c2b /main/term.c | |
parent | 69d3416c12f42ae21bb856ad14f6ea9753a4fb0d (diff) |
safe terminal output is sweet.
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@47491 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'main/term.c')
-rw-r--r-- | main/term.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/main/term.c b/main/term.c index a38399eda..e92a27077 100644 --- a/main/term.c +++ b/main/term.c @@ -264,6 +264,34 @@ 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] = ' '; + } + } + } + } + char *term_prep(void) { return prepdata; |