This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Defines | |
#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 |
#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) |
#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 32 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 39 of file term.h.
Referenced by __ast_register_translator(), ast_term_init(), ast_unregister_translator(), cli_prompt(), handle_zap_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 52 of file term.h.
Referenced by ast_register_application(), pbx_extension_helper(), and realtime_exec().
#define COLOR_BRMAGENTA (35 | 128) |
#define COLOR_BROWN 33 |
#define COLOR_BRWHITE (37 | 128) |
Definition at line 54 of file term.h.
Referenced by ast_log(), main(), and show_config_description().
#define COLOR_CYAN 36 |
Definition at line 51 of file term.h.
Referenced by handle_show_application(), handle_show_application_deprecated(), handle_show_function(), and handle_show_function_deprecated().
#define COLOR_GRAY (30 | 128) |
#define COLOR_GREEN 32 |
#define COLOR_MAGENTA 35 |
Definition at line 49 of file term.h.
Referenced by __ast_register_translator(), ast_unregister_translator(), handle_show_application(), handle_show_application_deprecated(), handle_show_function(), handle_show_function_deprecated(), and handle_zap_show_cadences().
#define COLOR_WHITE 37 |
Definition at line 53 of file term.h.
Referenced by ast_term_init(), cli_prompt(), term_color(), and term_prompt().
#define COLOR_YELLOW (33 | 128) |
#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 150 of file term.c.
References ATTR_BRIGHT, COLOR_BLACK, COLOR_WHITE, and ESC.
Referenced by __ast_register_translator(), ast_log(), ast_register_application(), ast_unregister_translator(), fix_header(), handle_show_application(), handle_show_application_deprecated(), handle_show_function(), handle_show_function_deprecated(), handle_zap_show_cadences(), load_resource(), main(), pbx_extension_helper(), realtime_exec(), and show_config_description().
00151 { 00152 int attr=0; 00153 char tmp[40]; 00154 if (!vt100compat) { 00155 ast_copy_string(outbuf, inbuf, maxout); 00156 return outbuf; 00157 } 00158 if (!fgcolor && !bgcolor) { 00159 ast_copy_string(outbuf, inbuf, maxout); 00160 return outbuf; 00161 } 00162 if ((fgcolor & 128) && (bgcolor & 128)) { 00163 /* Can't both be highlighted */ 00164 ast_copy_string(outbuf, inbuf, maxout); 00165 return outbuf; 00166 } 00167 if (!bgcolor) 00168 bgcolor = COLOR_BLACK; 00169 00170 if (bgcolor) { 00171 bgcolor &= ~128; 00172 bgcolor += 10; 00173 } 00174 if (fgcolor & 128) { 00175 attr = ATTR_BRIGHT; 00176 fgcolor &= ~128; 00177 } 00178 if (fgcolor && bgcolor) { 00179 snprintf(tmp, sizeof(tmp), "%d;%d", fgcolor, bgcolor); 00180 } else if (bgcolor) { 00181 snprintf(tmp, sizeof(tmp), "%d", bgcolor); 00182 } else if (fgcolor) { 00183 snprintf(tmp, sizeof(tmp), "%d", fgcolor); 00184 } 00185 if (attr) { 00186 snprintf(outbuf, maxout, "%c[%d;%sm%s%c[0;%d;%dm", ESC, attr, tmp, inbuf, ESC, COLOR_WHITE, COLOR_BLACK + 10); 00187 } else { 00188 snprintf(outbuf, maxout, "%c[%sm%s%c[0;%d;%dm", ESC, tmp, inbuf, ESC, COLOR_WHITE, COLOR_BLACK + 10); 00189 } 00190 return outbuf; 00191 }
char* term_color_code | ( | char * | outbuf, | |
int | fgcolor, | |||
int | bgcolor, | |||
int | maxout | |||
) |
Definition at line 193 of file term.c.
References ATTR_BRIGHT, COLOR_BLACK, and ESC.
Referenced by cli_prompt().
00194 { 00195 int attr=0; 00196 char tmp[40]; 00197 if ((!vt100compat) || (!fgcolor && !bgcolor)) { 00198 *outbuf = '\0'; 00199 return outbuf; 00200 } 00201 if ((fgcolor & 128) && (bgcolor & 128)) { 00202 /* Can't both be highlighted */ 00203 *outbuf = '\0'; 00204 return outbuf; 00205 } 00206 if (!bgcolor) 00207 bgcolor = COLOR_BLACK; 00208 00209 if (bgcolor) { 00210 bgcolor &= ~128; 00211 bgcolor += 10; 00212 } 00213 if (fgcolor & 128) { 00214 attr = ATTR_BRIGHT; 00215 fgcolor &= ~128; 00216 } 00217 if (fgcolor && bgcolor) { 00218 snprintf(tmp, sizeof(tmp), "%d;%d", fgcolor, bgcolor); 00219 } else if (bgcolor) { 00220 snprintf(tmp, sizeof(tmp), "%d", bgcolor); 00221 } else if (fgcolor) { 00222 snprintf(tmp, sizeof(tmp), "%d", fgcolor); 00223 } 00224 if (attr) { 00225 snprintf(outbuf, maxout, "%c[%d;%sm", ESC, attr, tmp); 00226 } else { 00227 snprintf(outbuf, maxout, "%c[%sm", ESC, tmp); 00228 } 00229 return outbuf; 00230 }
char* term_end | ( | void | ) |
Definition at line 295 of file term.c.
Referenced by consolehandler(), and main().
00296 { 00297 return enddata; 00298 }
void term_filter_escapes | ( | char * | line | ) |
Definition at line 268 of file term.c.
Referenced by ast_log(), and ast_verbose().
00269 { 00270 int i; 00271 int len = strlen(line); 00272 00273 for (i = 0; i < len; i++) { 00274 if (line[i] != ESC) 00275 continue; 00276 if ((i < (len - 2)) && 00277 (line[i + 1] == 0x5B)) { 00278 switch (line[i + 2]) { 00279 case 0x30: 00280 case 0x31: 00281 case 0x33: 00282 continue; 00283 } 00284 } 00285 /* replace ESC with a space */ 00286 line[i] = ' '; 00287 } 00288 }
char* term_prep | ( | void | ) |
char* term_prompt | ( | char * | outbuf, | |
const char * | inbuf, | |||
int | maxout | |||
) |
Definition at line 253 of file term.c.
References ATTR_BRIGHT, COLOR_BLACK, COLOR_BLUE, COLOR_WHITE, and ESC.
00254 { 00255 if (!vt100compat) { 00256 ast_copy_string(outbuf, inbuf, maxout); 00257 return outbuf; 00258 } 00259 snprintf(outbuf, maxout, "%c[%d;%d;%dm%c%c[%d;%d;%dm%s", 00260 ESC, ATTR_BRIGHT, COLOR_BLUE, COLOR_BLACK + 10, 00261 inbuf[0], 00262 ESC, 0, COLOR_WHITE, COLOR_BLACK + 10, 00263 inbuf + 1); 00264 return outbuf; 00265 }
char* term_quit | ( | void | ) |
Definition at line 300 of file term.c.
Referenced by ast_el_read_char(), main(), and quit_handler().
00301 { 00302 return quitdata; 00303 }
char* term_strip | ( | char * | outbuf, | |
char * | inbuf, | |||
int | maxout | |||
) |
Definition at line 232 of file term.c.
References ESC.
Referenced by action_command(), ast_log(), and ast_log_vsyslog().
00233 { 00234 char *outbuf_ptr = outbuf, *inbuf_ptr = inbuf; 00235 00236 while (outbuf_ptr < outbuf + maxout) { 00237 switch (*inbuf_ptr) { 00238 case ESC: 00239 while (*inbuf_ptr && (*inbuf_ptr != 'm')) 00240 inbuf_ptr++; 00241 break; 00242 default: 00243 *outbuf_ptr = *inbuf_ptr; 00244 outbuf_ptr++; 00245 } 00246 if (! *inbuf_ptr) 00247 break; 00248 inbuf_ptr++; 00249 } 00250 return outbuf; 00251 }