Asterisk - The Open Source Telephony Project
21.4.1
|
Terminal Routines. More...
#include "asterisk.h"
#include "asterisk/_private.h"
#include <sys/time.h>
#include <signal.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "asterisk/term.h"
#include "asterisk/lock.h"
#include "asterisk/utils.h"
#include "asterisk/threadstorage.h"
Go to the source code of this file.
Data Structures | |
struct | commonbuf |
Macros | |
#define | HEADER_LEN (12) |
#define | MAGIC_EXTNUM (01036) |
#define | MAGIC_LEGACY (00432) |
#define | MAX_COLORS_INDEX (13) |
Functions | |
static void | __init_commonbuf (void) |
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... | |
int | ast_term_init (void) |
const char * | ast_term_reset (void) |
Returns the terminal reset code. More... | |
static void | check_bgcolor (int *bgcolor) |
static int | check_colors_allowed (void) |
static void | check_fgcolor (int *fgcolor, int *attr) |
static int | convint (unsigned char *s) |
static short | convshort (unsigned char *s) |
static int | opposite (int color) |
static int | parse_terminfo_file (int fd) |
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... | |
Variables | |
static struct ast_threadstorage | commonbuf = { .once = PTHREAD_ONCE_INIT , .key_init = __init_commonbuf , .custom_init = NULL , } |
static char | enddata [80] = "" |
static char | quitdata [80] = "" |
static const char *const | termpath [] |
static int | vt100compat |
Terminal Routines.
Definition in file term.c.
const char* ast_term_color | ( | int | fgcolor, |
int | bgcolor | ||
) |
Return a color sequence string.
fgcolor | foreground color |
bgcolor | background color |
Definition at line 341 of file term.c.
References AST_TERM_MAX_ESCAPE_CHARS, ast_threadstorage_get(), and term_color_code().
Referenced by print_queue().
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 296 of file term.c.
References ast_str_append().
Referenced by ast_xmldoc_printable().
int ast_term_init | ( | void | ) |
const char* ast_term_reset | ( | void | ) |
Returns the terminal reset code.
Definition at line 357 of file term.c.
Referenced by ast_xmldoc_printable(), and print_queue().
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 235 of file term.c.
References ast_copy_string().
Referenced by __ast_register_translator(), ast_frame_dump(), ast_unregister_translator(), and lua_pbx_exec().
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 318 of file term.c.
Referenced by ast_term_color().
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 362 of file term.c.
References inbuf().
Referenced by action_command().