#include <stdio.h>#include <stdlib.h>#include <pthread.h>#include <string.h>#include <sys/time.h>#include <signal.h>#include <errno.h>#include <unistd.h>#include <asterisk/term.h>#include <asterisk/options.h>#include "asterisk.h"Go to the source code of this file.
Functions | |
| int | term_init (void) |
| char * | term_color (char *outbuf, const char *inbuf, int fgcolor, int bgcolor, int maxout) |
| char * | term_prompt (char *outbuf, const char *inbuf, int maxout) |
| char * | term_prep (void) |
| char * | term_end (void) |
| char * | term_quit (void) |
|
||||||||||||||||||||||||
|
Definition at line 54 of file term.c. References ATTR_BRIGHT, COLOR_BLACK, COLOR_WHITE, and ESC. Referenced by ast_frame_dump(), ast_load_resource(), ast_log(), ast_register_application(), ast_register_translator(), load_modules(), and main().
00055 {
00056 int attr=0;
00057 char tmp[40];
00058 if (!vt100compat) {
00059 strncpy(outbuf, inbuf, maxout -1);
00060 return outbuf;
00061 }
00062 if (!fgcolor && !bgcolor) {
00063 strncpy(outbuf, inbuf, maxout - 1);
00064 return outbuf;
00065 }
00066 if ((fgcolor & 128) && (bgcolor & 128)) {
00067 /* Can't both be highlighted */
00068 strncpy(outbuf, inbuf, maxout - 1);
00069 return outbuf;
00070 }
00071 if (!bgcolor)
00072 bgcolor = COLOR_BLACK;
00073
00074 if (bgcolor) {
00075 bgcolor &= ~128;
00076 bgcolor += 10;
00077 }
00078 if (fgcolor & 128) {
00079 attr = ATTR_BRIGHT;
00080 fgcolor &= ~128;
00081 }
00082 if (fgcolor && bgcolor) {
00083 snprintf(tmp, sizeof(tmp), "%d;%d", fgcolor, bgcolor);
00084 } else if (bgcolor) {
00085 snprintf(tmp, sizeof(tmp), "%d", bgcolor);
00086 } else if (fgcolor) {
00087 snprintf(tmp, sizeof(tmp), "%d", fgcolor);
00088 }
00089 if (attr) {
00090 snprintf(outbuf, maxout, "%c[%d;%sm%s%c[0;%d;%dm", ESC, attr, tmp, inbuf, ESC, COLOR_WHITE, COLOR_BLACK + 10);
00091 } else {
00092 snprintf(outbuf, maxout, "%c[%sm%s%c[0;%d;%dm", ESC, tmp, inbuf, ESC, COLOR_WHITE, COLOR_BLACK + 10);
00093 }
00094 return outbuf;
00095 }
|
|
|
Definition at line 116 of file term.c. Referenced by main().
00117 {
00118 return enddata;
00119 }
|
|
|
Definition at line 32 of file term.c. References ATTR_BRIGHT, ATTR_RESET, COLOR_BLACK, COLOR_BROWN, COLOR_WHITE, ESC, option_console, option_nocolor, and option_nofork. Referenced by main().
00033 {
00034 char *term = getenv("TERM");
00035 if (!term)
00036 return 0;
00037 if (!option_console || option_nocolor || !option_nofork)
00038 return 0;
00039 if (!strncasecmp(term, "linux", 5))
00040 vt100compat = 1; else
00041 if (!strncasecmp(term, "xterm", 5))
00042 vt100compat = 1; else
00043 if (!strncasecmp(term, "vt", 2))
00044 vt100compat = 1;
00045 if (vt100compat) {
00046 /* Make commands show up in nice colors */
00047 snprintf(prepdata, sizeof(prepdata), "%c[%d;%d;%dm", ESC, ATTR_BRIGHT, COLOR_BROWN, COLOR_BLACK + 10);
00048 snprintf(enddata, sizeof(enddata), "%c[%d;%d;%dm", ESC, ATTR_RESET, COLOR_WHITE, COLOR_BLACK + 10);
00049 snprintf(quitdata, sizeof(quitdata), "%c[0m", ESC);
00050 }
00051 return 0;
00052 }
|
|
|
Definition at line 111 of file term.c.
00112 {
00113 return prepdata;
00114 }
|
|
||||||||||||||||
|
Definition at line 97 of file term.c. References ATTR_BRIGHT, COLOR_BLACK, COLOR_BLUE, COLOR_WHITE, and ESC.
00098 {
00099 if (!vt100compat) {
00100 strncpy(outbuf, inbuf, maxout -1);
00101 return outbuf;
00102 }
00103 snprintf(outbuf, maxout, "%c[%d;%d;%dm%c%c[%d;%d;%dm%s",
00104 ESC, ATTR_BRIGHT, COLOR_BLUE, COLOR_BLACK + 10,
00105 inbuf[0],
00106 ESC, 0, COLOR_WHITE, COLOR_BLACK + 10,
00107 inbuf + 1);
00108 return outbuf;
00109 }
|
|
|
Definition at line 121 of file term.c. Referenced by main().
00122 {
00123 return quitdata;
00124 }
|
1.3.4