Go to the source code of this file.
Terminal Attributes | |
#define | ATTR_BLINK 5 |
#define | ATTR_BRIGHT 1 |
#define | ATTR_DIM 2 |
#define | ATTR_HIDDEN 8 |
#define | ATTR_RESET 0 |
#define | ATTR_REVER 7 |
#define | ATTR_UNDER 4 |
Terminal Colors | |
#define | COLOR_BLACK 30 |
#define | COLOR_BLUE 34 |
#define | COLOR_BRBLUE (34 | 128) |
#define | COLOR_BRCYAN (36 | 128) |
#define | COLOR_BRGREEN (32 | 128) |
#define | COLOR_BRMAGENTA (35 | 128) |
#define | COLOR_BROWN 33 |
#define | COLOR_BRRED (31 | 128) |
#define | COLOR_BRWHITE (37 | 128) |
#define | COLOR_CYAN 36 |
#define | COLOR_GRAY (30 | 128) |
#define | COLOR_GREEN 32 |
#define | COLOR_MAGENTA 35 |
#define | COLOR_RED 31 |
#define | COLOR_WHITE 37 |
#define | COLOR_YELLOW (33 | 128) |
Defines | |
#define | ESC 0x1b |
Functions | |
char * | term_color (char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout) |
char * | term_color_code (char *outbuf, int fgcolor, int bgcolor, int maxout) |
char * | term_end (void) |
void | term_filter_escapes (char *line) |
char * | term_prep (void) |
char * | term_prompt (char *outbuf, const char *inbuf, int maxout) |
char * | term_quit (void) |
char * | term_strip (char *outbuf, char *inbuf, int maxout) |
Definition in file term.h.
#define ATTR_BRIGHT 1 |
Definition at line 36 of file term.h.
Referenced by ast_term_init(), term_color(), term_color_code(), and term_prompt().
#define ATTR_RESET 0 |
#define COLOR_BLACK 30 |
Definition at line 47 of file term.h.
Referenced by __ast_register_translator(), ast_frame_dump(), ast_term_init(), ast_unregister_translator(), cli_prompt(), handle_dahdi_show_cadences(), load_resource(), main(), term_color(), term_color_code(), and term_prompt().
#define COLOR_BLUE 34 |
#define COLOR_BRCYAN (36 | 128) |
Definition at line 60 of file term.h.
Referenced by __ast_custom_function_register(), ast_frame_dump(), ast_register_application2(), lua_pbx_exec(), and pbx_extension_helper().
#define COLOR_BRGREEN (32 | 128) |
#define COLOR_BRMAGENTA (35 | 128) |
Definition at line 58 of file term.h.
Referenced by ast_frame_dump(), lua_pbx_exec(), and pbx_extension_helper().
#define COLOR_BROWN 33 |
#define COLOR_BRRED (31 | 128) |
#define COLOR_BRWHITE (37 | 128) |
Definition at line 62 of file term.h.
Referenced by logger_print_normal(), main(), and show_config_description().
#define COLOR_CYAN 36 |
Definition at line 59 of file term.h.
Referenced by handle_show_application(), and handle_show_function().
#define COLOR_GRAY (30 | 128) |
#define COLOR_GREEN 32 |
#define COLOR_MAGENTA 35 |
Definition at line 57 of file term.h.
Referenced by __ast_register_translator(), ast_unregister_translator(), handle_dahdi_show_cadences(), handle_show_application(), and handle_show_function().
#define COLOR_WHITE 37 |
Definition at line 61 of file term.h.
Referenced by ast_term_init(), cli_prompt(), term_color(), and term_prompt().
#define COLOR_YELLOW (33 | 128) |
Definition at line 54 of file term.h.
Referenced by ast_frame_dump(), and show_config_description().
#define ESC 0x1b |
Definition at line 30 of file term.h.
Referenced by ast_term_init(), term_color(), term_color_code(), term_filter_escapes(), term_prompt(), and term_strip().
char* term_color | ( | char * | outbuf, | |
const char * | inbuf, | |||
int | fgcolor, | |||
int | bgcolor, | |||
int | maxout | |||
) |
Definition at line 144 of file term.c.
References ast_copy_string(), ATTR_BRIGHT, COLOR_BLACK, COLOR_WHITE, and ESC.
Referenced by __ast_custom_function_register(), __ast_register_translator(), ast_frame_dump(), ast_register_application2(), ast_unregister_translator(), fix_header(), handle_dahdi_show_cadences(), handle_show_application(), handle_show_function(), load_resource(), logger_print_normal(), lua_pbx_exec(), main(), pbx_extension_helper(), and show_config_description().
00145 { 00146 int attr = 0; 00147 char tmp[40]; 00148 if (!vt100compat) { 00149 ast_copy_string(outbuf, inbuf, maxout); 00150 return outbuf; 00151 } 00152 if (!fgcolor && !bgcolor) { 00153 ast_copy_string(outbuf, inbuf, maxout); 00154 return outbuf; 00155 } 00156 if ((fgcolor & 128) && (bgcolor & 128)) { 00157 /* Can't both be highlighted */ 00158 ast_copy_string(outbuf, inbuf, maxout); 00159 return outbuf; 00160 } 00161 if (!bgcolor) 00162 bgcolor = COLOR_BLACK; 00163 00164 if (bgcolor) { 00165 bgcolor &= ~128; 00166 bgcolor += 10; 00167 } 00168 if (fgcolor & 128) { 00169 attr = ATTR_BRIGHT; 00170 fgcolor &= ~128; 00171 } 00172 if (fgcolor && bgcolor) { 00173 snprintf(tmp, sizeof(tmp), "%d;%d", fgcolor, bgcolor); 00174 } else if (bgcolor) { 00175 snprintf(tmp, sizeof(tmp), "%d", bgcolor); 00176 } else if (fgcolor) { 00177 snprintf(tmp, sizeof(tmp), "%d", fgcolor); 00178 } 00179 if (attr) { 00180 snprintf(outbuf, maxout, "%c[%d;%sm%s%c[0;%d;%dm", ESC, attr, tmp, inbuf, ESC, COLOR_WHITE, COLOR_BLACK + 10); 00181 } else { 00182 snprintf(outbuf, maxout, "%c[%sm%s%c[0;%d;%dm", ESC, tmp, inbuf, ESC, COLOR_WHITE, COLOR_BLACK + 10); 00183 } 00184 return outbuf; 00185 }
char* term_color_code | ( | char * | outbuf, | |
int | fgcolor, | |||
int | bgcolor, | |||
int | maxout | |||
) |
Definition at line 187 of file term.c.
References ATTR_BRIGHT, COLOR_BLACK, and ESC.
Referenced by cli_prompt().
00188 { 00189 int attr=0; 00190 char tmp[40]; 00191 if ((!vt100compat) || (!fgcolor && !bgcolor)) { 00192 *outbuf = '\0'; 00193 return outbuf; 00194 } 00195 if ((fgcolor & 128) && (bgcolor & 128)) { 00196 /* Can't both be highlighted */ 00197 *outbuf = '\0'; 00198 return outbuf; 00199 } 00200 if (!bgcolor) 00201 bgcolor = COLOR_BLACK; 00202 00203 if (bgcolor) { 00204 bgcolor &= ~128; 00205 bgcolor += 10; 00206 } 00207 if (fgcolor & 128) { 00208 attr = ATTR_BRIGHT; 00209 fgcolor &= ~128; 00210 } 00211 if (fgcolor && bgcolor) { 00212 snprintf(tmp, sizeof(tmp), "%d;%d", fgcolor, bgcolor); 00213 } else if (bgcolor) { 00214 snprintf(tmp, sizeof(tmp), "%d", bgcolor); 00215 } else if (fgcolor) { 00216 snprintf(tmp, sizeof(tmp), "%d", fgcolor); 00217 } 00218 if (attr) { 00219 snprintf(outbuf, maxout, "%c[%d;%sm", ESC, attr, tmp); 00220 } else { 00221 snprintf(outbuf, maxout, "%c[%sm", ESC, tmp); 00222 } 00223 return outbuf; 00224 }
char* term_end | ( | void | ) |
Definition at line 289 of file term.c.
Referenced by consolehandler(), and main().
00290 { 00291 return enddata; 00292 }
void term_filter_escapes | ( | char * | line | ) |
Definition at line 262 of file term.c.
Referenced by ast_log().
00263 { 00264 int i; 00265 int len = strlen(line); 00266 00267 for (i = 0; i < len; i++) { 00268 if (line[i] != ESC) 00269 continue; 00270 if ((i < (len - 2)) && 00271 (line[i + 1] == 0x5B)) { 00272 switch (line[i + 2]) { 00273 case 0x30: 00274 case 0x31: 00275 case 0x33: 00276 continue; 00277 } 00278 } 00279 /* replace ESC with a space */ 00280 line[i] = ' '; 00281 } 00282 }
char* term_prep | ( | void | ) |
char* term_prompt | ( | char * | outbuf, | |
const char * | inbuf, | |||
int | maxout | |||
) |
Definition at line 247 of file term.c.
References ast_copy_string(), ATTR_BRIGHT, COLOR_BLACK, COLOR_BLUE, COLOR_WHITE, and ESC.
00248 { 00249 if (!vt100compat) { 00250 ast_copy_string(outbuf, inbuf, maxout); 00251 return outbuf; 00252 } 00253 snprintf(outbuf, maxout, "%c[%d;%d;%dm%c%c[%d;%d;%dm%s", 00254 ESC, ATTR_BRIGHT, COLOR_BLUE, COLOR_BLACK + 10, 00255 inbuf[0], 00256 ESC, 0, COLOR_WHITE, COLOR_BLACK + 10, 00257 inbuf + 1); 00258 return outbuf; 00259 }
char* term_quit | ( | void | ) |
Definition at line 294 of file term.c.
Referenced by ast_el_read_char(), main(), and quit_handler().
00295 { 00296 return quitdata; 00297 }
char* term_strip | ( | char * | outbuf, | |
char * | inbuf, | |||
int | maxout | |||
) |
Definition at line 226 of file term.c.
References ESC.
Referenced by __verboser(), action_command(), and ast_log_vsyslog().
00227 { 00228 char *outbuf_ptr = outbuf, *inbuf_ptr = inbuf; 00229 00230 while (outbuf_ptr < outbuf + maxout) { 00231 switch (*inbuf_ptr) { 00232 case ESC: 00233 while (*inbuf_ptr && (*inbuf_ptr != 'm')) 00234 inbuf_ptr++; 00235 break; 00236 default: 00237 *outbuf_ptr = *inbuf_ptr; 00238 outbuf_ptr++; 00239 } 00240 if (! *inbuf_ptr) 00241 break; 00242 inbuf_ptr++; 00243 } 00244 return outbuf; 00245 }