|
Asterisk - The Open Source Telephony Project
18.5.0
|
Handy terminal functions for vt* terms. More...

Go to the source code of this file.
Macros | |
| #define | AST_TERM_MAX_ESCAPE_CHARS 23 |
| Maximum number of characters needed for a color escape sequence, and another one for a trailing reset, plus a null char. More... | |
| #define | AST_TERM_MAX_ROTATING_BUFFERS 15 |
| #define | COLORIZE(fg, bg, str) ast_term_color(fg,bg),str,ast_term_reset() |
| #define | COLORIZE_FMT "%s%s%s" |
| Shortcut macros for coloring a set of text. More... | |
| #define | ESC 0x1b |
Terminal Attributes | |
| #define | ATTR_RESET 0 |
| #define | ATTR_BRIGHT 1 |
| #define | ATTR_DIM 2 |
| #define | ATTR_UNDER 4 |
| #define | ATTR_BLINK 5 |
| #define | ATTR_REVER 7 |
| #define | ATTR_HIDDEN 8 |
Terminal Colors | |
| #define | COLOR_BLACK 30 |
| #define | COLOR_GRAY (30 | 128) |
| #define | COLOR_RED 31 |
| #define | COLOR_BRRED (31 | 128) |
| #define | COLOR_GREEN 32 |
| #define | COLOR_BRGREEN (32 | 128) |
| #define | COLOR_BROWN 33 |
| #define | COLOR_YELLOW (33 | 128) |
| #define | COLOR_BLUE 34 |
| #define | COLOR_BRBLUE (34 | 128) |
| #define | COLOR_MAGENTA 35 |
| #define | COLOR_BRMAGENTA (35 | 128) |
| #define | COLOR_CYAN 36 |
| #define | COLOR_BRCYAN (36 | 128) |
| #define | COLOR_WHITE 37 |
| #define | COLOR_BRWHITE (37 | 128) |
Functions | |
| const char * | ast_term_color (int fgcolor, int bgcolor) |
| Return a color sequence string. More... | |
| int | ast_term_color_code (struct ast_str **str, int fgcolor, int bgcolor) |
| Append a color sequence to an ast_str. More... | |
| const char * | ast_term_reset (void) |
| Returns the terminal reset code. More... | |
| char * | term_color (char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout) |
| Colorize a specified string by adding terminal color codes. More... | |
| char * | term_color_code (char *outbuf, int fgcolor, int bgcolor, int maxout) |
| Write a color sequence to a string. More... | |
| const char * | term_end (void) |
| void | term_filter_escapes (char *line) |
| const char * | term_quit (void) |
| char * | term_strip (char *outbuf, const char *inbuf, int maxout) |
| Remove colorings from a specified string. More... | |
Handy terminal functions for vt* terms.
Definition in file term.h.
| #define AST_TERM_MAX_ESCAPE_CHARS 23 |
Maximum number of characters needed for a color escape sequence, and another one for a trailing reset, plus a null char.
Definition at line 71 of file term.h.
Referenced by ast_term_color(), handle_cli_agi_show(), and handle_show_function().
| #define AST_TERM_MAX_ROTATING_BUFFERS 15 |
Definition at line 72 of file term.h.
Referenced by ast_term_color().
| #define ATTR_BRIGHT 1 |
Definition at line 36 of file term.h.
Referenced by check_fgcolor(), and term_color().
| #define ATTR_RESET 0 |
Definition at line 35 of file term.h.
Referenced by ast_term_init().
| #define COLOR_BLACK 30 |
Definition at line 47 of file term.h.
Referenced by __ast_register_translator(), ast_frame_dump(), ast_term_color_code(), ast_term_init(), ast_unregister_translator(), cli_prompt(), cli_show_module_options(), cli_show_module_type(), handle_dahdi_show_cadences(), opposite(), print_queue(), start_resource(), term_color(), and term_color_code().
| #define COLOR_BLUE 34 |
Definition at line 55 of file term.h.
Referenced by opposite().
| #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(), pbx_extension_helper(), and realtime_exec().
| #define COLOR_BRGREEN (32 | 128) |
Definition at line 52 of file term.h.
Referenced by ast_frame_dump(), and asterisk_daemon().
| #define COLOR_BRMAGENTA (35 | 128) |
Definition at line 58 of file term.h.
Referenced by ast_frame_dump(), bridge_parking_push(), lua_pbx_exec(), pbx_extension_helper(), and realtime_exec().
| #define COLOR_BROWN 33 |
Definition at line 53 of file term.h.
Referenced by opposite(), print_queue(), and start_resource().
| #define COLOR_BRRED (31 | 128) |
Definition at line 50 of file term.h.
Referenced by ast_frame_dump().
| #define COLOR_BRWHITE (37 | 128) |
Definition at line 62 of file term.h.
Referenced by format_log_default(), and show_config_description().
| #define COLOR_CYAN 36 |
Definition at line 59 of file term.h.
Referenced by ast_xmldoc_printable(), handle_cli_agi_show(), handle_show_function(), opposite(), print_app_docs(), and print_queue().
| #define COLOR_GRAY (30 | 128) |
Definition at line 48 of file term.h.
Referenced by set_header().
| #define COLOR_GREEN 32 |
Definition at line 51 of file term.h.
Referenced by handle_dahdi_show_cadences(), opposite(), print_queue(), test_cli_show_results(), and test_execute_multiple().
| #define COLOR_MAGENTA 35 |
Definition at line 57 of file term.h.
Referenced by __ast_register_translator(), ast_unregister_translator(), cli_show_module_options(), cli_show_module_type(), handle_cli_agi_show(), handle_dahdi_show_cadences(), handle_show_function(), handle_showmancmd(), opposite(), print_app_docs(), print_event_instance(), and print_queue().
| #define COLOR_RED 31 |
Definition at line 49 of file term.h.
Referenced by opposite(), print_queue(), test_cli_show_results(), and test_execute_multiple().
| #define COLOR_WHITE 37 |
Definition at line 61 of file term.h.
Referenced by ast_term_init(), and cli_prompt().
| #define COLOR_YELLOW (33 | 128) |
Definition at line 54 of file term.h.
Referenced by ast_frame_dump(), and show_config_description().
| #define COLORIZE | ( | fg, | |
| bg, | |||
| str | |||
| ) | ast_term_color(fg,bg),str,ast_term_reset() |
Definition at line 68 of file term.h.
Referenced by __ast_custom_function_register(), ast_register_application2(), asterisk_daemon(), bridge_parking_push(), format_log_default(), pbx_extension_helper(), and print_app_docs().
| #define COLORIZE_FMT "%s%s%s" |
Shortcut macros for coloring a set of text.
Definition at line 67 of file term.h.
Referenced by __ast_custom_function_register(), ast_register_application2(), asterisk_daemon(), bridge_parking_push(), format_log_default(), pbx_extension_helper(), and print_app_docs().
| #define ESC 0x1b |
Definition at line 30 of file term.h.
Referenced by ast_term_color_code(), ast_term_init(), term_color(), term_color_code(), term_filter_escapes(), term_strip(), and xmldoc_string_wrap().
| const char* ast_term_color | ( | int | fgcolor, |
| int | bgcolor | ||
| ) |
Return a color sequence string.
| fgcolor | foreground color |
| bgcolor | background color |
Definition at line 290 of file term.c.
References AST_TERM_MAX_ESCAPE_CHARS, AST_TERM_MAX_ROTATING_BUFFERS, ast_threadstorage_get(), buf, commonbuf::buffer, term_color_code(), and commonbuf::which.
Referenced by print_app_docs(), print_queue(), and set_header().
| int ast_term_color_code | ( | struct ast_str ** | str, |
| int | fgcolor, | ||
| int | bgcolor | ||
| ) |
Append a color sequence to an ast_str.
| str | The string to append to |
| fgcolor | foreground color |
| bgcolor | background color |
| 0 | success |
| -1 | failure |
Definition at line 245 of file term.c.
References ast_opt_force_black_background, ast_str_append(), check_bgcolor(), check_colors_allowed(), check_fgcolor(), COLOR_BLACK, and ESC.
Referenced by ast_xmldoc_printable(), and cli_prompt().
| const char* ast_term_reset | ( | void | ) |
Returns the terminal reset code.
Definition at line 306 of file term.c.
References term_end().
Referenced by ast_xmldoc_printable(), cli_show_module_options(), print_app_docs(), print_queue(), and set_header().
| char* term_color | ( | char * | outbuf, |
| const char * | inbuf, | ||
| int | fgcolor, | ||
| int | bgcolor, | ||
| int | maxout | ||
| ) |
Colorize a specified string by adding terminal color codes.
| outbuf | Result buffer |
| inbuf | Starting string |
| fgcolor | Foreground color, specified as one of the constants in include/asterisk/term.h. Use '0' if the want the normal terminal foreground color. |
| bgcolor | Background color, specified as one of the constants in include/asterisk/term.h. Use '0' if you want the normal terminal background color. |
| maxout | Maximum size of outbuf |
Definition at line 184 of file term.c.
References ast_copy_string(), ast_opt_force_black_background, ast_opt_light_background, ATTR_BRIGHT, COLOR_BLACK, ESC, opposite(), term_end(), and vt100compat.
Referenced by __ast_register_translator(), ast_frame_dump(), ast_unregister_translator(), cli_show_module_options(), cli_show_module_type(), handle_cli_agi_show(), handle_dahdi_show_cadences(), handle_show_function(), handle_showmancmd(), lua_pbx_exec(), print_event_instance(), realtime_exec(), show_config_description(), start_resource(), test_cli_show_results(), and test_execute_multiple().
| char* term_color_code | ( | char * | outbuf, |
| int | fgcolor, | ||
| int | bgcolor, | ||
| int | maxout | ||
| ) |
Write a color sequence to a string.
| outbuf | the location to write to |
| fgcolor | foreground color |
| bgcolor | background color |
| maxout | maximum number of characters to write |
Definition at line 267 of file term.c.
References ast_opt_force_black_background, check_bgcolor(), check_colors_allowed(), check_fgcolor(), COLOR_BLACK, and ESC.
Referenced by ast_term_color().
| const char* term_end | ( | void | ) |
Definition at line 356 of file term.c.
References enddata.
Referenced by ast_remotecontrol(), ast_term_reset(), asterisk_daemon(), consolehandler(), main(), and term_color().
| void term_filter_escapes | ( | char * | line | ) |
Definition at line 334 of file term.c.
| const char* term_quit | ( | void | ) |
Definition at line 361 of file term.c.
References quitdata.
Referenced by ast_el_read_char(), check_init(), main(), and really_quit().
| char* term_strip | ( | char * | outbuf, |
| const char * | inbuf, | ||
| int | maxout | ||
| ) |
Remove colorings from a specified string.
| outbuf | the location to write to |
| inbuf | the original string |
| maxout | the available size of outbuf |
Definition at line 311 of file term.c.
Referenced by action_command(), format_log_default(), format_log_json(), and format_log_plain().
1.8.13