Go to the source code of this file.
◆ gethtmlcolor()
static const char* gethtmlcolor |
( |
const char |
ptrch | ) |
|
|
static |
Definition at line 17 of file html.c.
19 case '0':
return "#000";
20 case '1':
return "#f00";
21 case '2':
return "#0f0";
22 case '3':
return "#ff0";
23 case '4':
return "#00f";
24 case '5':
return "#f0f";
25 case '6':
return "#aaf";
26 case '7':
return "#fff";
27 case '8':
return "#777";
Referenced by rz_cons_html_filter().
◆ gethtmlrgb()
static bool gethtmlrgb |
( |
const char * |
str, |
|
|
char * |
buf |
|
) |
| |
|
static |
◆ rz_cons_html_filter()
Definition at line 34 of file html.c.
35 const char *
str = ptr;
39 char text_color[16] = { 0 };
40 char background_color[16] = { 0 };
42 bool need_to_set =
false;
43 bool need_to_clear =
false;
53 for (; ptr[0]; ptr = ptr + 1) {
54 if (esc == 0 && ptr[0] != 0x1b && need_to_set) {
65 if (background_color[0]) {
78 need_to_clear =
false;
92 }
else if (ptr[0] ==
'<') {
98 }
else if (ptr[0] ==
'>') {
104 }
else if (ptr[0] ==
' ') {
111 if (ptr[0] == 0x1b) {
121 eprintf(
"Oops invalid escape char\n");
128 }
else if (esc == 2) {
130 if (ptr[0] ==
'0' && ptr[1] ==
'J') {
134 }
else if (!memcmp(ptr,
"2K", 2)) {
139 }
else if (ptr[0] ==
'2' && ptr[1] ==
'J') {
145 }
else if (!strncmp(ptr,
"48;5;", 5) || !strncmp(ptr,
"48;2;", 5)) {
146 char *
end = strchr(ptr,
'm');
152 }
else if (!strncmp(ptr,
"38;5;", 5) || !strncmp(ptr,
"38;2;", 5)) {
153 char *
end = strchr(ptr,
'm');
159 }
else if (ptr[0] ==
'0' && ptr[1] ==
';' && ptr[2] ==
'0') {
165 }
else if (ptr[0] ==
'0' && ptr[1] ==
'm') {
169 text_color[0] =
'\0';
170 background_color[0] =
'\0';
171 need_to_set = need_to_clear =
true;
174 }
else if (!strncmp(ptr,
"27m", 3)) {
182 }
else if (ptr[0] ==
'7' && ptr[1] ==
'm') {
189 }
else if (ptr[0] ==
'3' && ptr[2] ==
'm') {
192 rz_str_ncpy(text_color, htmlColor,
sizeof(text_color));
199 }
else if (ptr[0] ==
'4' && ptr[2] ==
'm') {
202 rz_str_ncpy(background_color, htmlColor,
sizeof(background_color));
RZ_API void rz_cons_gotoxy(int x, int y)
static const char * gethtmlcolor(const char ptrch)
static bool gethtmlrgb(const char *str, char *buf)
RZ_API size_t rz_str_ncpy(char *dst, const char *src, size_t n)
Secure string copy with null terminator.
RZ_API RZ_OWN char * rz_strbuf_drain(RzStrBuf *sb)
RZ_API bool rz_strbuf_append(RzStrBuf *sb, const char *s)
RZ_API RzStrBuf * rz_strbuf_new(const char *s)
RZ_API bool rz_strbuf_appendf(RzStrBuf *sb, const char *fmt,...) RZ_PRINTF_CHECK(2
RZ_API bool rz_strbuf_append_n(RzStrBuf *sb, const char *s, size_t l)
References test_evm::end, eprintf, gethtmlcolor(), gethtmlrgb(), int, len, RzStrBuf::len, NULL, rz_cons_gotoxy(), rz_str_ncpy(), rz_strbuf_append(), rz_strbuf_append_n(), rz_strbuf_appendf(), rz_strbuf_drain(), rz_strbuf_new(), cmd_descs_generate::str, and autogen_x86imm::tmp.
Referenced by ds_newline(), and rz_cons_filter().