91 }
else if (!strcmp(
encoding,
"mutf8")) {
93 }
else if (!strcmp(
encoding,
"utf8")) {
95 }
else if (!strcmp(
encoding,
"utf16le")) {
97 }
else if (!strcmp(
encoding,
"utf32le")) {
99 }
else if (!strcmp(
encoding,
"utf16be")) {
101 }
else if (!strcmp(
encoding,
"utf32be")) {
103 }
else if (!strcmp(
encoding,
"ibm037")) {
105 }
else if (!strcmp(
encoding,
"ibm290")) {
107 }
else if (!strcmp(
encoding,
"ebcdices")) {
109 }
else if (!strcmp(
encoding,
"ebcdicuk")) {
111 }
else if (!strcmp(
encoding,
"ebcdicus")) {
113 }
else if (!strcmp(
encoding,
"base64")) {
123 return stricmp(
s1,
s2);
125 return strcasecmp(
s1,
s2);
131 return _strnicmp(
s1,
s2,
n);
133 return strncasecmp(
s1,
s2,
n);
145 for (; *o;
s++, o++) {
176 memmove(
str,
str + 1, strlen(
str + 1) + 1);
186 for (
i = 0;
i < half;
i++) {
198 for (
i = j = 0;
i <
len && (!bitz || bitz[
i]);
i++) {
199 if (
i > 0 && (
i % 8) == 0) {
202 if (*
buf & (1 << (
i % 8))) {
207 for (
i = j = 0;
i <
len;
i++) {
209 int bit = 7 - (
i % 8);
210 strout[j++] = (
buf[
idx] & (1 <<
bit)) ?
'1' :
'0';
234 const int len = strlen(
b);
235 char *one = strchr(
b,
'1');
236 int pos = one ? (
int)(
size_t)(one -
b) :
len - 1;
247 for (
i = (
sizeof(
in) * 8) - 1;
i >= 0;
i--) {
256 strout[
count] =
'\0';
270 char *ch = strchr(bitz,
toupper((
const unsigned char)*
buf));
272 ch = strchr(bitz,
tolower((
const unsigned char)*
buf));
275 int bit = (
int)(
size_t)(ch - bitz);
287 for (
n =
i = 0;
i <
len;
i += 8) {
289 while (
str[
i] ==
' ') {
293 for (
k = 0, j =
i + 7; j >=
i; j--,
k++) {
302 }
else if (
str[j] !=
'0') {
321 ret |= strchr(
str,
'm') ? 16 : 0;
322 ret |= strchr(
str,
'r') ? 4 : 0;
323 ret |= strchr(
str,
'w') ? 2 : 0;
324 ret |= strchr(
str,
'x') ? 1 : 0;
344 for (; *
str; oc = *
str++) {
363 length = strlen(home) + 1;
371 int home_len = strlen(home);
375 strcpy(
dst + home_len + 1,
str);
389 h = (
h ^ (
h << 5)) ^ *
s++;
395 char *_a = strchr(
p,
a);
396 char *_b = strchr(
p,
b);
397 return (!_a || !_b) ? 0 : (_a - _b);
410 for (
i = 1,
p =
str; *
p;
p++) {
430 if (
i > 0 &&
str[
i - 1] ==
' ' &&
str[
i] ==
' ') {
439 for (
i = 1,
p =
str; *
p;
p++) {
448 memmove(
p,
p + 1, strlen(
p + 1) + 1);
456 if (
p >
str && (*q ==
'\\' || !*q)) {
457 memmove(
p,
p + 1, strlen(
p + 1) + 1);
480 if (
i > 0 &&
str[
i - 1] ==
' ' &&
str[
i] ==
' ') {
484 if (
i == 0 &&
str[
i] ==
' ') {
492 for (
i = 1,
p =
str; *
p;
p++) {
494 if (
p >
str && (*q ==
'\\')) {
495 memmove(q,
p, strlen(
p) + 1);
508 if (pop && *(
char *)pop != *
p) {
520 if ((*(
char *)pop ==
'(' && *
p ==
')') ||
521 (*(
char *)pop ==
'{' && *
p ==
'}') ||
522 (*(
char *)pop ==
'[' && *
p ==
']')) {
528 if (
p >
str && !*q) {
529 memmove(
p,
p + 1, strlen(
p + 1) + 1);
551 int alen, blen, nlen;
559 int nslen = strlen(
newstr);
572 blen = stralen - ((alen + strlen(
p)) + 1);
576 nlen = alen + blen + strlen(
newstr);
590 *newlen = nlen + ((blen == 0) ? 1 : 0);
600 const char *ptr =
str;
601 if (!ptr ||
idx < 0 ) {
604 for (
i = 0;
i !=
idx;
i++) {
613 for (
i = 0;
string[
i];
i++) {
614 if (
string[
i] == ch) {
647 for (word = 0; *
text; word++) {
661 while (*
str == chr) {
705 if (!
c[0] || !
c[1]) {
708 return ((
c[0] & 0xe0) == 0xc0) && ((
c[1] & 0xc0) == 0x80);
719 if (!
c[0] || !
c[1] || !
c[2]) {
722 return ((
c[0] & 0xf0) == 0xe0) && ((
c[1] & 0xc0) == 0x80) && ((
c[2] & 0xc0) == 0x80);
733 if (!
c[0] || !
c[1] || !
c[2] || !
c[3]) {
736 return ((
c[0] & 0xf8) == 0xf0) && ((
c[1] & 0xc0) == 0x80) && ((
c[2] & 0xc0) == 0x80) && ((
c[3] & 0xc0) == 0x80);
751 return isascii(
c[0]);
773 while (
i <= str_len &&
i + c_len <= str_len) {
775 if (
str[
i] ==
c[0]) {
791 for (
i = 0; sep[
i];
i++) {
792 if (*base == sep[
i]) {
804 for (
i = 0; sep[
i];
i++) {
819 char *q = strstr(
s,
k);
820 const char *
r =
NULL;
822 r = base + strlen(base) - (q -
s) - strlen(
p);
832 return strrchr(base, ch);
834 for (;
p >= base;
p--) {
839 return (
p >= base) ?
p :
NULL;
846 if ((
c = *
find++) !=
'\0') {
850 if (slen-- < 1 || !(
sc = *
s++)) {
857 }
while (strncmp(
s,
find,
len) != 0);
892 strcpy(
buf +
len - 4,
"...");
902 if (!strchr(fmt,
'%')) {
931 return strlcpy(
dst,
src, dst_size);
933 strncpy(
dst,
src, dst_size - 1);
934 dst[dst_size - 1] =
'\0';
954 if (!
list || !item) {
959 if (item[j] !=
list[
i]) {
975 if ((
a ==
b) || (!
a && !
b)) {
987 return strncmp(
a,
b,
len);
1007 if (!ptr ||
len < 0) {
1033 slen = strlen(
string);
1034 ptr =
realloc(ptr, slen + plen + 1);
1038 memmove(ptr + slen, ptr, plen + 1);
1039 memmove(ptr,
string, slen);
1064 if (
string && !ptr) {
1070 int plen = strlen(ptr);
1071 int slen = strlen(
string);
1072 char *newptr =
realloc(ptr, slen + plen + 1);
1078 memcpy(ptr + plen,
string, slen + 1);
1087 if (!strchr(fmt,
'%')) {
1106 char b[2] = { y, 0 };
1118 int klen = strlen(
key);
1119 int vlen = strlen(
val);
1120 if (klen == 1 && vlen < 2) {
1124 if (klen == vlen && !strcmp(
key,
val)) {
1136 int tlen = slen - (
off + klen);
1137 slen += vlen - klen;
1148 memmove(
p + vlen,
p + klen, tlen + 1);
1163 int off,
i, klen, vlen, slen;
1169 for (
i = 0;
i < slen;) {
1176 int tlen = slen - (
off + klen);
1177 slen += vlen - klen;
1186 memmove(
p + vlen,
p + klen, tlen + 1);
1192 if (!tmp_val || !str_case) {
1234 const char *
key,
const char *
val,
int g) {
1235 int i, klen, vlen, slen,
delta = 0, bias;
1236 char *
newstr, *scnd, *
p = clean, *str_p;
1238 if (!
str || !
key || !
val || !clean || !thunk) {
1243 if (klen == vlen && !strcmp(
key,
val)) {
1246 slen = strlen(
str) + 1;
1248 for (
i = 0;
i < clen;) {
1250 (
const ut8 *)clean +
i, clen -
i,
1255 i = (
int)(
size_t)(
p - clean);
1260 int newo = thunk[
i + klen] - thunk[
i];
1262 scnd =
strdup(str_p + newo);
1277 memcpy(str_p + vlen, scnd, strlen(scnd) + 1);
1294 strncpy(
str, heaped, sz);
1301 unsigned char ch = 0, ch2 = 0;
1305 for (
i = 0;
buf[
i];
i++) {
1306 if (
buf[
i] !=
'\\') {
1309 int esc_seq_len = 2;
1310 switch (
buf[
i + 1]) {
1343 eprintf(
"Unexpected end of string.\n");
1349 eprintf(
"Error: Non-hexadecimal chars in input.\n");
1352 buf[
i] = (ch << 4) + ch2;
1370 esc_seq_len = 1 + num_digits;
1376 memmove(
buf +
i + 1,
buf +
i + esc_seq_len, strlen(
buf +
i + esc_seq_len) + 1);
1384 for (; *
d;
c++,
d++) {
1409 size_t len = strlen(
s);
1417 if (!(
c >=
'a' &&
c <=
'z') && !(
c >=
'A' &&
c <=
'Z') && !(
c >=
'0' &&
c <=
'9') &&
c !=
'_' &&
c !=
':') {
1441 *q++ = opt->
dot_nl ?
'l' :
'n';
1491 *q++ =
"0123456789abcdef"[*
p >> 4 & 0xf];
1492 *q++ =
"0123456789abcdef"[*
p & 0xf];
1512 const char *
p =
buf;
1517 if (parse_esc_seq) {
1518 const char *start_seq =
p;
1526 for (
p++; *
p !=
'm';
p++) {
1532 memcpy(q, start_seq,
p - start_seq + 1);
1533 q += (
p - start_seq + 1);
1562 char *new_buf =
malloc(1 + strlen(
buf) * 2);
1566 const char *
p =
buf;
1601 const char *
p, *
end;
1603 int i,
len, ch_bytes;
1648 if (ch_bytes == 0) {
1655 if (ch_bytes == 0) {
1661 }
else if (ch_bytes > 1) {
1662 if (keep_printable) {
1666 *q++ = ch_bytes == 4 ?
'U' :
'u';
1667 for (
i = ch_bytes == 4 ? 6 : 2;
i >= 0;
i -= 2) {
1668 *q++ =
"0123456789abcdef"[ch >> 4 * (
i + 1) & 0xf];
1669 *q++ =
"0123456789abcdef"[ch >> 4 *
i & 0xf];
1685 p += ch_bytes < 2 ? 2 : ch_bytes;
1727 int i,
len, ch_bytes;
1744 if (ch_bytes == 1) {
1780 *q++ =
"0123456789abcdef"[*
p >> 4 & 0xf];
1781 *q++ =
"0123456789abcdef"[*
p & 0xf];
1786 }
else if (ch_bytes == 4) {
1789 for (
i = 0;
i < ch_bytes;
i++) {
1795 high = 0xd800 + (ch >> 10 & 0x3ff);
1796 low = 0xdc00 + (ch & 0x3ff);
1799 for (
i = 2;
i >= 0;
i -= 2) {
1800 *q++ =
"0123456789abcdef"[high >> 4 * (
i + 1) & 0xf];
1801 *q++ =
"0123456789abcdef"[high >> 4 *
i & 0xf];
1805 for (
i = 2;
i >= 0;
i -= 2) {
1806 *q++ =
"0123456789abcdef"[low >> 4 * (
i + 1) & 0xf];
1807 *q++ =
"0123456789abcdef"[low >> 4 *
i & 0xf];
1810 }
else if (ch_bytes > 1) {
1813 for (
i = 0;
i < ch_bytes;
i++) {
1819 for (
i = 2;
i >= 0;
i -= 2) {
1820 *q++ =
"0123456789abcdef"[ch >> 4 * (
i + 1) & 0xf];
1821 *q++ =
"0123456789abcdef"[ch >> 4 *
i & 0xf];
1849 for (
i = 0;
i < argc;
i++) {
1854 bool must_escape = strchr(
arg,
'\"') !=
NULL;
1855 bool must_quote = strpbrk(
arg,
" \t") !=
NULL || !*
arg;
1856 if (!must_escape && must_quote && *
arg &&
arg[strlen(
arg) - 1] ==
'\\') {
1864 size_t bs_count = 0;
1868 for (; bs_count; bs_count--) {
1887 for (; bs_count; bs_count--) {
1904 if (
str[0] == 0x1b) {
1905 if (
str[1] ==
'[') {
1910 }
else if (
str[1] ==
'#') {
1924 size_t i = 0,
len = 0;
1926 while (
str[
i] &&
i < slen) {
1933 return len > 0 ?
len : 1;
1942 return len > 0 ?
len : 1;
1969 while (*
str &&
n > 0) {
1990 for (ptr = (
const ut8 *)
str; *ptr; ptr++) {
2006 for (
const char *ptr =
str; *ptr !=
'\0'; ptr++) {
2026 size_t len = strlen(
str);
2077 if (*
str !=
'\r' && *
str !=
'\n' && *
str !=
'\t') {
2092 while (*
s++ || *
s++) {
2105 if ((
str[
i] & 0xc0) != 0x80) {
2144 for (
i = j = 0;
i <
len;
i++) {
2145 if (
tmp[
i] == 0x1b) {
2175 char *
r, *rz_end, *ret;
2176 const char *
s, *s_start;
2177 size_t rz_len, str_len = 0, nr_of_lines = 0;
2178 ut32 ch = 0, cw = 0;
2179 if (
x2 <=
x || y2 <= y || !
str) {
2190 rz_len = str_len + nr_of_lines * strlen(
Color_RESET) + 1;
2195 rz_end =
r + rz_len;
2203 if (ch >= y && ch < y2) {
2205 if (strlen(reset) < (rz_end -
r)) {
2206 const int reset_length = strlen(reset);
2207 memcpy(
r, reset, reset_length + 1);
2215 if (ch >= y && ch < y2) {
2216 if ((*
str & 0xc0) == 0x80) {
2232 if (*
str == 0x1b && *(
str + 1) ==
'[') {
2233 const char *ptr =
str;
2234 if ((rz_end -
r) > 2) {
2238 for (ptr =
str; *ptr && *ptr !=
'J' && *ptr !=
'm' && *ptr !=
'H'; ptr++) {
2245 }
else if (cw >=
x && cw <
x2) {
2251 while (*
str && *
str !=
'\n') {
2265 if ((*
s & 0x80) != 0x80) {
2267 }
else if ((*
s & 0xe0) == 0xc0 && left >= 1) {
2268 return ((*
s & 0x1f) << 6) + (*(
s + 1) & 0x3f);
2269 }
else if ((*
s & 0xf0) == 0xe0 && left >= 2) {
2270 return ((*
s & 0xf) << 12) + ((*(
s + 1) & 0x3f) << 6) + (*(
s + 2) & 0x3f);
2271 }
else if ((*
s & 0xf8) == 0xf0 && left >= 3) {
2272 return ((*
s & 0x7) << 18) + ((*(
s + 1) & 0x3f) << 12) + ((*(
s + 2) & 0x3f) << 6) + (*(
s + 3) & 0x3f);
2279 return (codepoint >= 0x1100 &&
2280 (codepoint <= 0x115f ||
2281 codepoint == 0x2329 || codepoint == 0x232a ||
2282 (
RZ_BETWEEN(0x2e80, codepoint, 0xa4cf) && codepoint != 0x303f) ||
2304 if ((
str[
size] & 0xc0) != 0x80) {
2320 size_t size = 0, minsize =
RZ_MIN(5, prev_len);
2321 while (
size < minsize) {
2323 if ((
str[--
pos] & 0xc0) != 0x80) {
2337 size_t len = strlen(
str);
2344 if (
str[
i] ==
'\n' ||
str[
i] ==
'\r') {
2361 for (
i = 0;
str[
i];
i++) {
2372 char *begin = strchr(glob,
'^');
2386 if (*glob == *
str) {
2393 return (*++glob ==
'\x00');
2399 if (*glob != *
str) {
2406 while (*glob ==
'*') {
2409 return ((*glob ==
'$' && !*glob++) || !*glob);
2415 int dest_i = 0, src_i = 0;
2423 for (src_i = 0;
arg[src_i] !=
'\0'; src_i++) {
2424 char c =
arg[src_i];
2430 str[dest_i++] =
'\\';
2444 int dest_i = 0, src_i = 0;
2448 for (src_i = 0;
arg[src_i] !=
'\0'; src_i++) {
2449 char c =
arg[src_i];
2451 if (
arg[++src_i] ==
'\0') {
2454 arg[dest_i++] =
arg[src_i];
2465 int dest_i = 0, src_i = 0;
2476 for (src_i = 0;
path[src_i] !=
'\0'; src_i++) {
2477 char c =
path[src_i];
2480 str[dest_i++] =
'\\';
2497 if (
path[
i] !=
'\\') {
2500 if (
path[
i + 1] ==
' ') {
2513 int cmdline_current = 0;
2514 int args_current = 0;
2521 char **
argv =
malloc(argv_len *
sizeof(
char *));
2525 args =
malloc(128 + strlen(cmdline) *
sizeof(
char));
2533 int singlequoted = 0;
2534 int doublequoted = 0;
2537 while (cmdline[cmdline_current] !=
'\0' &&
IS_WHITECHAR(cmdline[cmdline_current])) {
2541 if (cmdline[cmdline_current] ==
'\0') {
2546 char c = cmdline[cmdline_current];
2547 int end_of_current_arg = 0;
2554 args[args_current++] =
'\\';
2555 args[args_current++] =
c;
2558 args[args_current++] =
'\\';
2559 end_of_current_arg = 1;
2562 args[args_current++] =
'\\';
2563 args[args_current++] =
c;
2570 args[args_current++] =
c;
2572 singlequoted = !singlequoted;
2577 args[args_current++] =
c;
2579 doublequoted = !doublequoted;
2586 if (singlequoted || doublequoted) {
2587 args[args_current++] =
c;
2589 end_of_current_arg = 1;
2593 end_of_current_arg = 1;
2596 args[args_current++] =
c;
2599 if (end_of_current_arg) {
2604 args[args_current++] =
'\0';
2606 if (argc >= argv_len) {
2616 arg_begin = args_current;
2617 }
while (cmdline[cmdline_current++] !=
'\0');
2638 while (
argv[argc]) {
2647 const char *isbut, *
p;
2648 const int bsz =
sizeof(_b) * 8;
2650 return strchr(
s, ch);
2652 if (strlen(but) >= bsz) {
2653 eprintf(
"rz_str_firstbut: but string too long\n");
2656 for (
p =
s; *
p;
p++) {
2657 isbut = strchr(but, *
p);
2659 idx = (
int)(
size_t)(isbut - but);
2663 if (*
p == ch && !_b) {
2673 const char *isbut, *
p, *lp =
NULL;
2674 const int bsz =
sizeof(_b) * 8;
2678 if (strlen(but) >= bsz) {
2679 eprintf(
"rz_str_lastbut: but string too long\n");
2682 for (
p =
s; *
p;
p++) {
2683 isbut = strchr(but, *
p);
2685 idx = (
int)(
size_t)(isbut - but);
2689 if (*
p == ch && !_b) {
2699 while (
s[
i] && (!left ||
i < left)) {
2700 if ((
s[
i] & 0xc0) != 0x80) {
2710 size_t i = 0, j = 0, fullwidths = 0;
2712 if ((
s[
i] & 0xc0) != 0x80) {
2720 return j + fullwidths;
2724 int i = 0,
len = 0, fullwidths = 0;
2730 }
else if ((ch & 0xc0) != 0x80) {
2738 return len + fullwidths;
2743 const char *ch, *
p =
a;
2745 ch = strchr(
p,
'\x1b');
2754 return strstr(
p,
b);
2760 size_t hay_len = strlen(
a);
2761 size_t needle_len = strlen(
b);
2762 if (!hay_len || !needle_len) {
2765 while (hay_len >= needle_len) {
2767 return (
const char *)
a;
2789 int to = atoi(
r + 1);
2794 fprintf(stderr,
"Invalid range\n");
2796 for (
r++; *
r && *
r !=
',' && *
r !=
'-';
r++) {
2827 fprintf(stderr,
"Invalid range\n");
2829 for (
r++; *
r && *
r !=
',' && *
r !=
'-';
r++) {
2848 for (
d =
s; *
s;
s++,
d++) {
2850 sscanf(
s + 1,
"%02x", &
n);
2861 char ch[4], *
d, *od;
2865 od =
d =
malloc(1 + (strlen(
s) * 4));
2870 if ((*
s >=
'0' && *
s <=
'9') || (*
s >=
'a' && *
s <=
'z') || (*
s >=
'A' && *
s <=
'Z')) {
2880 char *trimDown =
realloc(od, strlen(od) + 1);
2881 return trimDown ? trimDown : od;
2886 ut8 *outend =
dst + len_dst;
2893 if ((len_src % 2) == 1) {
2896 inlen = len_src / 2;
2898 while ((
in < inend) && (
dst - outstart + 5 < len_dst)) {
2899 if (little_endian) {
2910 if ((
c & 0xFC00) == 0xD800) {
2914 if (little_endian) {
2922 if ((
d & 0xFC00) == 0xDC00) {
2933 if (
dst >= outend) {
2939 }
else if (
c < 0x800) {
2940 *
dst++ = ((
c >> 6) & 0x1F) | 0xC0;
2942 }
else if (
c < 0x10000) {
2943 *
dst++ = ((
c >> 12) & 0x0F) | 0xE0;
2946 *
dst++ = ((
c >> 18) & 0x07) | 0xF0;
2951 if (
dst >= outend) {
2954 *
dst++ = ((
c >>
bits) & 0x3F) | 0x80;
2957 len_dst =
dst - outstart;
2964 char *result =
NULL;
2965 int count_unicode = 0;
2966 int count_ascii = 0;
2971 for (
i = 0;
i <
len && (
s[
i] ||
s[
i + 1]);
i += 2) {
2972 if (!
s[
i + 1] && 0x20 <=
s[
i] &&
s[
i] <= 0x7E) {
2978 lenresult = 1 + count_ascii + count_unicode * 6;
2979 if (!(result =
calloc(1 + count_ascii + count_unicode * 6, 1))) {
2982 for (
i = 0;
i <
len && j < lenresult && (
s[
i] ||
s[
i + 1]);
i += 2) {
2995 char ch[4], *
d, *od, *
tmp;
3002 if ((
len * 7) + 1 <
len) {
3009 for (
i = 0;
i <
len;
s++,
i++) {
3013 }
else if (*
s ==
'"') {
3016 }
else if ((*
s >= 0x20) && (*
s <= 126)) {
3052 pfx_len = strlen(pfx);
3053 for (os =
s; *os; os++) {
3058 char *o =
malloc(
len + (pfx_len * newlines) + 1);
3063 for (
p = o + pfx_len; *
s;
s++) {
3065 if (*
s ==
'\n' &&
s[1]) {
3074 #define HASCH(x) strchr(input_value, x)
3075 #define CAST (void *)(size_t)
3077 char *has_tilde = input_value ?
HASCH(
'~') :
NULL,
3078 *has_bang = input_value ?
HASCH(
'!') :
NULL,
3082 *has_qmark = input_value ?
HASCH(
'?') :
NULL,
3083 *has_colon = input_value ?
HASCH(
':') :
NULL,
3084 *has_at = input_value ? strchr(input_value,
'@') :
NULL;
3086 return has_tilde || has_bang || has_brace || has_cbrace || has_qmark || has_paren || has_colon || has_at;
3091 if (
string && *
string) {
3092 ut32 sz = strlen(
string);
3094 switch (
string[
pos]) {
3114 for (
a =
s; *
a;
a++) {
3125 const char *
str, *ptr;
3158 unsigned int x2,
unsigned int y2) {
3160 unsigned int ch = 0, cw = 0;
3161 if (
x2 < 1 || y2 < 1 || !
str) {
3173 if (ch >= y && ch < y2) {
3180 if (ch >= y && ch < y2 && cw >=
x && cw <
x2) {
3186 while (*
str && *
str !=
'\n') {
3200 const char *
p = str1;
3208 for (;
i <
len;
i++,
p++) {
3225 for (ret = 0; (
str[ret] != tok) &&
str[ret]; ret++) {
3229 for (ret = 0; (
str[ret] != tok) &&
str[ret]; ret++) {
3237 static char pad[1024];
3242 if (sz <
sizeof(
pad)) {
3245 pad[
sizeof(
pad) - 1] = 0;
3258 for (
i = 1;
i < sz;
i++) {
3288 if (
str == needle) {
3291 return !strncmp(
str, needle, strlen(needle));
3303 if (
str == needle) {
3314 int slen = strlen(
str);
3315 int nlen = strlen(needle);
3316 if (!slen || !nlen || slen < nlen) {
3319 return case_sensitive ? !strcmp(
str + (slen - nlen), needle) : !
rz_str_ncasecmp(
str + (slen - nlen), needle, nlen);
3350 size_t clen = strlen(
c);
3353 if (
n > 0 && ++
i >
n) {
3379 if (
n ==
i &&
n > 0) {
3533 size_t *res =
RZ_NEWS(
size_t, cnt);
3540 rz_list_foreach (l, it,
s) {
3571 ptr = strstr(
str, ch);
3587 while (
s2[j] == 0x1b) {
3589 while (
s2[j] &&
s2[j] !=
'm') {
3609 while (
s1[
i] == 0x1b) {
3610 while (
s1[
i] &&
s1[
i] !=
'm') {
3617 while (
s2[j] == 0x1b) {
3618 while (
s2[j] &&
s2[j] !=
'm') {
3625 if (
s1[
i] !=
s2[j]) {
3639 for (
i = 0;
s[
i];
i++) {
3640 while (
s[
i] &&
s[
i] == 0x1b) {
3641 while (
s[
i] &&
s[
i] !=
'm') {
3648 if (!
s[
i] ||
s[
i] == (
char)
c) {
3649 return (
char *)
s +
i;
3661 ut32 i = 0, j = 0, to_copy;
3664 ut32 l_reset = strlen(color_reset);
3669 if (!word || !*word) {
3672 ut32 l_word = strlen(word);
3674 char o[1024] = { 0 };
3681 if (to_copy + j + 1 >
sizeof(o)) {
3685 strncpy(o + j,
str +
i, to_copy);
3689 if (j + strlen(
color) >=
sizeof(o)) {
3693 strcpy(o + j,
color);
3695 if (j + l_word >=
sizeof(o)) {
3702 if (j + strlen(color_reset) >=
sizeof(o)) {
3706 strcpy(o + j, color_reset);
3712 if (j + strlen(
str +
i) >=
sizeof(o)) {
3715 strcpy(o + j,
str +
i);
3723 wchar_t *res_buf =
NULL;
3731 if (sz == (
size_t)-1) {
3732 goto err_r_str_mb_to_wc;
3734 res_buf = (
wchar_t *)
calloc(1, (sz + 1) *
sizeof(wchar_t));
3736 goto err_r_str_mb_to_wc;
3738 sz = mbstowcs(res_buf,
buf, sz + 1);
3739 if (sz == (
size_t)-1) {
3740 goto err_r_str_mb_to_wc;
3751 char *res_buf =
NULL;
3752 mbstate_t mbstate = { 0 };
3758 sz = wcsrtombs(
NULL, &
buf, 0, &mbstate);
3759 if (sz == (
size_t)-1) {
3760 goto err_r_str_wc_to_mb;
3764 goto err_r_str_wc_to_mb;
3766 sz = wcsrtombs(res_buf, &
buf, sz + 1, &mbstate);
3767 if (sz == (
size_t)-1) {
3768 goto err_r_str_wc_to_mb;
3793 char *
v = (
char *)&
val;
3798 while (
i < 8 && *
v) {
3808 string[
len - 1] = 0;
3815 size_t i, j, klen, slen,
off;
3824 for (
i = 0;
i < slen;) {
3839 for (j =
i; j < slen -
off + 1; j++) {
3869 for (
i = 1;
i <
n;
i++) {
3881 if (fmt[1] ==
'*') {
3897 return b ?
"true" :
"false";
3913 char *
p = strchr(
s, ch);
3943 for (
i = 0;
i <
h;
i++) {
3944 int zoomedline =
i * (
int)((
float)rows /
h);
3946 int cols = strlen(srcline);
3947 for (j = 0; j <
w; j++) {
3948 int zoomedcol = j * ((
float)cols /
w);
3949 linetext[j] = srcline[zoomedcol];
3951 if (curline != zoomedline) {
3953 curline = zoomedline;
3967 const char *
src = prev ? prev + 1 :
s;
3968 const char *
d = strstr(
src, word);
3973 for (q = prev ? prev :
s; q <
d; q++) {
4003 char *
p, *start_line =
str;
4004 char *first_space =
NULL, *last_space =
NULL;
4014 if (!last_space ||
p != last_space + 1) {
4015 if (
p - start_line >
width && first_space) {
4017 *first_space =
'\0';
4018 start_line = last_space + 1;
4030 if (
p > start_line) {
4041 #ifdef RZ_PACKAGER_VERSION
4043 #define RZ_STR_PKG_VERSION_STRING ", package: " RZ_PACKAGER_VERSION " (" RZ_PACKAGER ")"
4045 #define RZ_STR_PKG_VERSION_STRING ", package: " RZ_PACKAGER_VERSION
4048 #define RZ_STR_PKG_VERSION_STRING ""
4062 char *gittip =
NULL;
4063 if (!gittip_pathname) {
4074 free(gittip_pathname);
4079 #undef RZ_STR_PKG_VERSION_STRING
4095 for (
ut32 i = 0, utf32le = 0, utf32be = 0, utf16le = 0, utf16be = 0, ascii = 0;
i <
length; ++
i) {
4125 if (ascii >
length - 1) {
4143 if (
option->length < 1) {
4190 rsize = rune < 0x7F ? 1 : 0;
4213 for (
int j = 0; j < rsize; ++j) {
4218 }
else if (
option->json) {
4224 if (wrap_at && line_runes + 1 >= wrap_at) {
4229 }
else if (rune ==
'\0' &&
option->stop_at_nil) {
4231 }
else if (rune ==
'\n') {
4237 if (
IS_DIGIT(rune) ||
IS_UPPER(rune) ||
IS_LOWER(rune) || rune ==
'-' || rune ==
'_' || rune ==
'.' || rune ==
'~') {
4247 for (
int j = 0; j < n_enc; ++j) {
4251 }
else if (
option->json) {
4252 if (
IS_PRINTABLE(rune) && rune !=
'\"' && rune !=
'\\') {
4255 }
else if (rune ==
'\n') {
4257 }
else if (rune ==
'\r') {
4259 }
else if (rune ==
'\\') {
4261 }
else if (rune ==
'\t') {
4263 }
else if (rune ==
'\f') {
4265 }
else if (rune ==
'\b') {
4267 }
else if (rune ==
'"') {
4270 for (
int j = 0; j < rsize; ++j) {
4274 n_runes += rsize - 1;
4280 char tmp[5] = { 0 };
4286 for (
int j = 0; j < n_enc; ++j) {
4291 if (wrap_at && line_runes + 1 >= wrap_at) {
static const char * arg(RzAnalysis *a, csh *handle, cs_insn *insn, char *buf, int n)
static RASN1String * newstr(const char *string)
lsl lsr asr ror lsl lsr asr ror lsl lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror c1
lsl lsr asr ror lsl lsr asr ror lsl lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror lsl lsr asr ror c0
static RzBinSourceLineInfo * lines(RzBinFile *bf)
int bits(struct state *s, int need)
const lzma_allocator const uint8_t * in
const lzma_allocator const uint8_t size_t uint8_t * out
static static fork const void static count static fd const char const char static newpath const char static path const char path
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void count
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void start
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len key
static static sync static getppid static getegid const char static filename char static len const char char static bufsiz static mask static vfork const void static prot static getpgrp const char static swapflags static arg static fd static protocol static who struct sockaddr static addrlen static backlog struct timeval struct timezone static tz const struct iovec static count static mode const void const struct sockaddr static tolen const char static pathname void static offset struct stat static buf void long static basep static whence static length const void static len static semflg const void static shmflg const struct timespec struct timespec static rem const char static group const void length
void trim(string &s, string characters)
unsigned char suffix[65536]
unsigned short prefix[65536]
RZ_API void Ht_() free(HtName_(Ht) *ht)
RZ_API VALUE_TYPE Ht_() find(HtName_(Ht) *ht, const KEY_TYPE key, bool *found)
return memset(p, 0, total)
memcpy(mem, inblock.get(), min(CONTAINING_RECORD(inblock.get(), MEMBLOCK, data) ->size, size))
static void list(RzEgg *egg)
RZ_API RZ_OWN RzList * rz_list_newf(RzListFree f)
Returns a new initialized RzList pointer and sets the free method.
RZ_API RZ_OWN RzList * rz_list_new(void)
Returns a new initialized RzList pointer (free method is not initialized)
RZ_API RZ_BORROW void * rz_list_get_n(RZ_NONNULL const RzList *list, ut32 n)
Returns the N-th element of the list.
RZ_API ut32 rz_list_length(RZ_NONNULL const RzList *list)
Returns the length of the list.
RZ_API RZ_OWN void * rz_list_pop_head(RZ_NONNULL RzList *list)
Removes and returns the first element of the list.
RZ_API RZ_BORROW RzListIter * rz_list_append(RZ_NONNULL RzList *list, void *data)
Appends at the end of the list a new element.
RZ_API void rz_list_free(RZ_NONNULL RzList *list)
Empties the list and frees the list pointer.
void * realloc(void *ptr, size_t size)
void * malloc(size_t size)
void * calloc(size_t number, size_t size)
static static fork const void static count static fd const char const char static newpath char char char static envp time_t static t const char static mode static whence const char static dir time_t static t unsigned static seconds const char struct utimbuf static buf static inc static sig const char static mode dup
static static fork const void static count static fd const char const char static newpath char char argv
return strdup("=SP r13\n" "=LR r14\n" "=PC r15\n" "=A0 r0\n" "=A1 r1\n" "=A2 r2\n" "=A3 r3\n" "=ZF zf\n" "=SF nf\n" "=OF vf\n" "=CF cf\n" "=SN or0\n" "gpr lr .32 56 0\n" "gpr pc .32 60 0\n" "gpr cpsr .32 64 0 ____tfiae_________________qvczn\n" "gpr or0 .32 68 0\n" "gpr tf .1 64.5 0 thumb\n" "gpr ef .1 64.9 0 endian\n" "gpr jf .1 64.24 0 java\n" "gpr qf .1 64.27 0 sticky_overflow\n" "gpr vf .1 64.28 0 overflow\n" "gpr cf .1 64.29 0 carry\n" "gpr zf .1 64.30 0 zero\n" "gpr nf .1 64.31 0 negative\n" "gpr itc .4 64.10 0 if_then_count\n" "gpr gef .4 64.16 0 great_or_equal\n" "gpr r0 .32 0 0\n" "gpr r1 .32 4 0\n" "gpr r2 .32 8 0\n" "gpr r3 .32 12 0\n" "gpr r4 .32 16 0\n" "gpr r5 .32 20 0\n" "gpr r6 .32 24 0\n" "gpr r7 .32 28 0\n" "gpr r8 .32 32 0\n" "gpr r9 .32 36 0\n" "gpr r10 .32 40 0\n" "gpr r11 .32 44 0\n" "gpr r12 .32 48 0\n" "gpr r13 .32 52 0\n" "gpr r14 .32 56 0\n" "gpr r15 .32 60 0\n" "gpr r16 .32 64 0\n" "gpr r17 .32 68 0\n")
size_t strnlen(const char *str, size_t maxlen)
static void pad(RzStrBuf *sb, ut32 count)
#define rz_warn_if_reached()
#define rz_return_val_if_fail(expr, val)
RZ_API int rz_str_ibm037_to_unicode(const ut8 src, RZ_NONNULL RZ_OUT RzRune *dst)
Convert an ibm037 char into an unicode RzRune.
RZ_API int rz_str_ibm290_to_unicode(const ut8 src, RZ_NONNULL RZ_OUT RzRune *dst)
Convert an ibm290 char into an unicode RzRune.
RZ_API int rz_str_ebcdic_es_to_unicode(const ut8 src, RZ_NONNULL RZ_OUT RzRune *dst)
Convert an ebcdic_es char into an unicode RzRune.
RZ_API int rz_str_ebcdic_us_to_unicode(const ut8 src, RZ_NONNULL RZ_OUT RzRune *dst)
Convert an ebcdic_us char into an unicode RzRune.
RZ_API int rz_str_ebcdic_uk_to_unicode(const ut8 src, RZ_NONNULL RZ_OUT RzRune *dst)
Convert an ebcdic_uk char into an unicode RzRune.
RZ_API char * rz_file_tmpdir(void)
RZ_API RZ_OWN char * rz_file_slurp(const char *str, RZ_NULLABLE size_t *usz)
RZ_API bool rz_hex_to_byte(ut8 *val, ut8 c)
#define RZ_LOG_ERROR(fmtstr,...)
RZ_API int rz_mem_eq(const ut8 *a, const ut8 *b, int len)
Compares memory a with b over len bytes.
RZ_API const ut8 * rz_mem_mem_aligned(const ut8 *haystack, int hlen, const ut8 *needle, int nlen, int align)
RZ_API const ut8 * rz_mem_mem(const ut8 *haystack, int hlen, const ut8 *needle, int nlen)
RZ_API ut64 rz_num_get(RzNum *num, const char *str)
RZ_API RZ_OWN char * rz_path_bindir(void)
Return the directory where the Rizin binaries are placed.
RZ_API RzRegex * rz_regex_new(const char *pattern, const char *cflags)
RZ_API int rz_regex_exec(const RzRegex *preg, const char *string, size_t nmatch, RzRegexMatch __pmatch[], int eflags)
RZ_API void rz_regex_free(RzRegex *)
RZ_API bool rz_stack_is_empty(RzStack *s)
RZ_API void * rz_stack_pop(RzStack *s)
RZ_API bool rz_stack_push(RzStack *s, void *el)
RZ_API RzStack * rz_stack_new(ut32 n)
RZ_API void rz_stack_free(RzStack *s)
#define RZ_STR_ISNOTEMPTY(x)
@ RZ_STRING_ENC_EBCDIC_US
@ RZ_STRING_ENC_EBCDIC_UK
@ RZ_STRING_ENC_EBCDIC_ES
#define RZ_STR_ISEMPTY(x)
RZ_API const char * rz_str_trim_head_ro(const char *str)
int(* RzStrRangeCallback)(void *, int)
RZ_API void rz_str_trim(RZ_NONNULL RZ_INOUT char *str)
Removes whitespace characters (space, tab, newline etc.) from the beginning and end of a string.
void(* str_operation)(char *c)
static const char * rz_str_word_get_next0(const char *str)
RZ_API RZ_OWN char * rz_strbuf_drain(RzStrBuf *sb)
RZ_API RZ_OWN char * rz_strbuf_drain_nofree(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 void rz_strbuf_init(RzStrBuf *sb)
RZ_API int rz_strbuf_length(RzStrBuf *sb)
RZ_API bool rz_strbuf_append_n(RzStrBuf *sb, const char *s, size_t l)
RZ_API char * rz_sys_getenv(const char *key)
Get the value of an environment variable named key or NULL if none exists.
#define RZ_BIT_TOGGLE(x, y)
#define RZ_BETWEEN(x, y, z)
RZ_API int rz_utf16_decode(const ut8 *ptr, int ptrlen, RzRune *ch, bool bigendian)
RZ_API int rz_utf16le_decode(const ut8 *ptr, int ptrlen, RzRune *ch)
RZ_API int rz_utf16be_decode(const ut8 *ptr, int ptrlen, RzRune *ch)
RZ_API int rz_utf32le_decode(const ut8 *ptr, int ptrlen, RzRune *ch)
RZ_API int rz_utf32_decode(const ut8 *ptr, int ptrlen, RzRune *ch, bool bigendian)
RZ_API int rz_utf32be_decode(const ut8 *ptr, int ptrlen, RzRune *ch)
RZ_API RzStrEnc rz_utf_bom_encoding(const ut8 *ptr, int ptrlen)
RZ_API int rz_utf8_decode(const ut8 *ptr, int ptrlen, RzRune *ch)
RZ_API bool rz_rune_is_printable(const RzRune c)
Returns true when the RzRune is a printable symbol.
RZ_API int rz_mutf8_decode(const ut8 *ptr, int ptrlen, RzRune *ch)
RZ_API int rz_utf8_encode(ut8 *ptr, const RzRune ch)
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr from
static struct sockaddr static addrlen static backlog const void static flags void struct sockaddr socklen_t static fromlen const void const struct sockaddr to
static struct sockaddr static addrlen static backlog const void msg
RZ_API int rz_str_utf16_to_utf8(ut8 *dst, int len_dst, const ut8 *src, int len_src, bool little_endian)
RZ_API RzList * rz_str_split_duplist_n(const char *_str, const char *c, int n, bool trim)
Split the string str according to the substring c and returns a RzList with the result.
RZ_API void rz_str_byte_escape(const char *p, char **dst, RzStrEscOptions *opt)
Converts unprintable characters to C-like backslash representation.
static bool str_endswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle, bool case_sensitive)
RZ_API void rz_str_truncate_cmd(char *string)
RZ_API int rz_str_char_count(const char *string, char ch)
RZ_API size_t rz_str_ansi_nlen(const char *str, size_t slen)
RZ_API char * rz_str_append_owned(char *ptr, char *string)
RZ_API char * rz_str_appendf(char *ptr, const char *fmt,...)
RZ_API char * rz_str_escape_dot(const char *buf)
RZ_API bool rz_str_is_false(const char *s)
RZ_API const char * rz_str_lchr(const char *str, char chr)
RZ_API ut8 rz_str_contains_macro(const char *input_value)
static const char * separator_get_first(const char *text)
RZ_API bool rz_str_char_fullwidth(const char *s, size_t left)
RZ_API const char * rz_str_pad(const char ch, int sz)
RZ_API char * rz_str_crop(const char *str, unsigned int x, unsigned int y, unsigned int x2, unsigned int y2)
RZ_API const char * rz_str_rwx_i(int rwx)
RZ_API bool rz_str_range_in(const char *r, ut64 addr)
RZ_API const char * rz_str_str_xy(const char *s, const char *word, const char *prev, int *x, int *y)
RZ_API size_t rz_str_utf8_charsize_prev(const char *str, int prev_len)
RZ_API RZ_OWN RzList * rz_str_split_duplist_n_regex(RZ_NONNULL const char *_str, RZ_NONNULL const char *r, int n, bool trim)
Split the string str according to the regex r and returns a RzList with the result.
RZ_API ut64 rz_str_bits_from_string(const char *buf, const char *bitz)
RZ_API const char * rz_str_last(const char *str, const char *ch)
RZ_API char * rz_str_replace_icase(char *str, const char *key, const char *val, int g, int keep_case)
RZ_API bool rz_str_cmp_list(const char *list, const char *item, char sep)
RZ_API char * rz_str_repeat(const char *ch, int sz)
static const char * rwxstr[]
static size_t __str_ansi_length(char const *str)
RZ_API int rz_str_replace_ch(char *s, char a, char b, bool global)
RZ_API bool rz_str_is4utf8(RZ_NONNULL const char *c)
Checks if the given character string is a four byte UTF-8 character.
RZ_API size_t rz_str_utf8_charsize_last(const char *str)
RZ_API const char * rz_str_sep(const char *base, const char *sep)
RZ_API char * rz_str_append(char *ptr, const char *string)
RZ_API char * rz_str_ndup(RZ_NULLABLE const char *ptr, int len)
Create new copy of string ptr limited to size len.
RZ_API char * rz_str_escape_utf16be(const char *buf, int buf_size, RzStrEscOptions *opt)
RZ_API bool rz_str_is_true(const char *s)
RZ_API char * rz_str_between(const char *cmt, const char *prefix, const char *suffix)
RZ_API RZ_OWN char * rz_str_escape(RZ_NONNULL const char *buf)
RZ_API int rz_str_word_set0_stack(char *str)
RZ_API char * rz_str_newf(const char *fmt,...)
RZ_API int rz_str_ncasecmp(const char *s1, const char *s2, size_t n)
RZ_API char * rz_str_sanitize_sdb_key(const char *s)
RZ_API char * rz_str_new(const char *str)
RZ_API int rz_str_rwx(const char *str)
RZ_API ut64 rz_str_djb2_hash(const char *s)
RZ_API char * rz_str_replace_in(char *str, ut32 sz, const char *key, const char *val, int g)
RZ_API size_t rz_str_ansi_len(const char *str)
RZ_API char * rz_str_escape_utf8_keep_printable(const char *buf, RzStrEscOptions *opt)
#define RZ_STR_PKG_VERSION_STRING
RZ_API int rz_str_arg_unescape(char *arg)
RZ_API RzStrEnc rz_str_enc_string_as_type(RZ_NULLABLE const char *encoding)
converts an encoding name to RzStrEnc
RZ_API char * rz_str_wc_to_mb_l(const wchar_t *buf, int len)
RZ_API char ** rz_str_argv(const char *cmdline, int *_argc)
RZ_API void rz_str_stripLine(char *str, const char *key)
RZ_API const char * rz_str_rchr(const char *base, const char *p, int ch)
static RzList * str_split_list_common_regex(RZ_BORROW char *str, RZ_BORROW RzRegex *r, int n, bool trim, bool dup)
RZ_API int rz_str_path_unescape(char *path)
RZ_API int rz_str_fmtargs(const char *fmt)
static int strncpy_with_color_codes(char *s1, char *s2, int n)
RZ_API const char * rz_str_bool(int b)
RZ_API char * rz_str_appendlen(char *ptr, const char *string, int slen)
RZ_API char * rz_str_ichr(char *str, char chr)
RZ_API int rz_str_word_count(const char *string)
RZ_API char * rz_str_appendch(char *x, char y)
RZ_API void rz_str_uri_decode(char *s)
RZ_API int rz_str_ccpy(char *dst, char *src, int ch)
RZ_API int rz_str_ansi_filter(char *str, char **out, int **cposs, int len)
RZ_API char * rz_str_dup(char *ptr, const char *string)
RZ_API char * rz_str_format_msvc_argv(size_t argc, const char **argv)
RZ_API bool rz_str_is_utf8(RZ_NONNULL const char *str)
Returns true if the input string is correctly UTF-8-encoded.
RZ_API void rz_str_case(char *str, bool up)
RZ_API const char * rz_str_enc_as_string(RzStrEnc enc)
RZ_API RZ_OWN RzList * rz_str_split_list_regex(RZ_NONNULL char *str, RZ_NONNULL const char *r, int n)
Split the string str according to the regex r and returns a RzList with the result.
RZ_API const char * rz_str_ansi_chrn(const char *str, size_t n)
RZ_API char * rz_str_escape_mutf8_for_json(const char *buf, int buf_size)
static void trimbits(char *b)
RZ_API char * rz_str_word_get_first(const char *text)
RZ_API int rz_str_binstr2bin(const char *str, ut8 *out, int outlen)
RZ_API char * rz_str_wc_to_mb(const wchar_t *buf)
static char * rz_str_escape_utf(const char *buf, int buf_size, RzStrEnc enc, bool show_asciidot, bool esc_bslash, bool esc_double_quotes, bool keep_printable)
RZ_API bool rz_str_startswith_icase(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case insensitive)
RZ_API size_t rz_str_utf8_codepoint(const char *s, size_t left)
RZ_API char * rz_str_array_join(const char **a, size_t n, const char *sep)
RZ_API int rz_str_do_until_token(str_operation op, char *str, const char tok)
RZ_API int rz_str_bounds(const char *_str, int *h)
RZ_API char * rz_str_home(const char *str)
RZ_API const char * rz_str_rstr(const char *base, const char *p)
RZ_API int rz_str_replace_char_once(char *s, int a, int b)
RZ_API size_t rz_str_nlen_w(const char *str, int n)
RZ_API char * rz_str_uri_encode(const char *s)
RZ_API char * rz_str_utf16_encode(const char *s, int len)
RZ_API int rz_str_bits64(char *strout, ut64 in)
RZ_API char * rz_str_escape_utf32le(const char *buf, int buf_size, RzStrEscOptions *opt)
RZ_API RzList * rz_str_split_duplist(const char *_str, const char *c, bool trim)
Split the string str according to the substring c and returns a RzList with the result.
RZ_API bool rz_str_is_printable_limited(const char *str, int size)
RZ_API bool rz_str_glob(const char *str, const char *glob)
RZ_API int rz_str_cmp(const char *a, const char *b, int len)
RZ_API int rz_str_delta(char *p, char a, char b)
RZ_API void rz_str_range_foreach(const char *r, RzStrRangeCallback cb, void *u)
RZ_API void rz_str_filter(char *str)
Convert all non-printable characters in str with '.'.
RZ_API size_t rz_str_nlen(const char *str, size_t n)
RZ_API char * rz_str_prepend(char *ptr, const char *string)
RZ_API RzList * rz_str_wrap(char *str, size_t width)
RZ_API char * rz_str_escape_8bit(const char *buf, bool colors, RzStrEscOptions *opt)
RZ_API char * rz_str_escape_utf8(const char *buf, RzStrEscOptions *opt)
RZ_API bool rz_str_isnumber(const char *str)
static RzList * str_split_list_common(char *str, const char *c, int n, bool trim, bool dup)
RZ_API char * rz_str_newlen(const char *str, int len)
RZ_API size_t rz_str_len_utf8(const char *s)
RZ_API const char * rz_str_tok(const char *str1, const char b, size_t len)
RZ_API int rz_str_bits(char *strout, const ut8 *buf, int len, const char *bitz)
RZ_API char * rz_str_prefix_all(const char *s, const char *pfx)
RZ_API bool rz_str_is2utf8(RZ_NONNULL const char *c)
Checks if the given character string is a two byte UTF-8 character.
RZ_API char * rz_str_utf16_decode(const ut8 *s, int len)
RZ_API const char * rz_str_rsep(const char *base, const char *p, const char *sep)
RZ_API char * rz_str_replace_thunked(char *str, char *clean, int *thunk, int clen, const char *key, const char *val, int g)
RZ_API size_t rz_wstr_clen(const char *s)
RZ_API char * rz_str_replace(char *str, const char *key, const char *val, int g)
RZ_API size_t rz_str_ncpy(char *dst, const char *src, size_t dst_size)
Secure string copy with null terminator.
RZ_API int rz_str_casecmp(const char *s1, const char *s2)
RZ_API bool rz_str_is_whitespace(RZ_NONNULL const char *str)
Checks if the whole string is composed of whitespace.
RZ_API const char * rz_sub_str_rchr(const char *str, int start, int end, char chr)
static int strncmp_skip_color_codes(const char *s1, const char *s2, int n)
RZ_API bool rz_str_is_printable_incl_newlines(const char *str)
RZ_API bool rz_str_is3utf8(RZ_NONNULL const char *c)
Checks if the given character string is a three byte UTF-8 character.
RZ_API const char * rz_str_firstbut(const char *s, char ch, const char *but)
RZ_API char * rz_str_escape_utf32be(const char *buf, int buf_size, RzStrEscOptions *opt)
RZ_API const char * rz_str_strchr(RZ_NONNULL const char *str, RZ_NONNULL const char *c)
Returns a pointer to the first occurrence of UTF-8 character c in the string s.
RZ_API char * rz_str_ansi_crop(const char *str, ut32 x, ut32 y, ut32 x2, ut32 y2)
RZ_API bool rz_str_is_printable(const char *str)
RZ_API char * rz_str_trunc_ellipsis(const char *str, int len)
RZ_API int rz_str_word_set0(char *str)
RZ_API char * rz_str_path_escape(const char *path)
RZ_API bool rz_str_is_bool(const char *val)
RZ_API bool rz_str_startswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string starts with a specifc sequence of characters (case sensitive)
RZ_API char * rz_str_highlight(char *str, const char *word, const char *color, const char *color_reset)
static char * escape_utf8_for_json(const char *buf, int buf_size, bool mutf8)
RZ_API bool rz_str_isXutf8(RZ_NONNULL const char *c, ut8 x)
Checks if the byte string matches the criteria of a UTF-8 character of length x.
RZ_API wchar_t * rz_str_mb_to_wc(const char *buf)
RZ_API const char * rz_strstr_ansi(const char *a, const char *b)
RZ_API char * rz_str_escape_utf16le(const char *buf, int buf_size, RzStrEscOptions *opt)
RZ_API char * rz_str_scale(const char *s, int w, int h)
RZ_API size_t rz_str_len_utf8char(const char *s, int left)
RZ_API int rz_str_replace_char(char *s, int a, int b)
RZ_API const char * rz_str_casestr(const char *a, const char *b)
RZ_API bool rz_str_ccmp(const char *dst, const char *src, int ch)
RZ_API const char * rz_sub_str_lchr(const char *str, int start, int end, char chr)
RZ_API size_t rz_str_utf8_charsize(const char *str)
RZ_API size_t rz_str_len_utf8_ansi(const char *str)
static char * strchr_skip_color_codes(const char *s, int c)
RZ_API size_t * rz_str_split_lines(char *str, size_t *count)
Split the string str in lines and returns the result in an array.
RZ_API char * rz_str_escape_utf8_for_json(const char *buf, int buf_size)
RZ_API char * rz_str_version(const char *program)
RZ_API char * rz_str_word_get0set(char *stra, int stralen, int idx, const char *newstr, int *newlen)
RZ_API RzStrEnc rz_str_guess_encoding_from_buffer(RZ_NONNULL const ut8 *buffer, ut32 length)
Tries to guess the string encoding method from the buffer.
RZ_API RzList * rz_str_split_list(char *str, const char *c, int n)
Split the string str according to the substring c and returns a RzList with the result.
RZ_API int rz_str_unescape(char *buf)
RZ_API void rz_str_filter_zeroline(char *str, int len)
RZ_API int rz_snprintf(char *string, int len, const char *fmt,...)
RZ_API const char * rz_str_word_get0(const char *str, int idx)
RZ_API bool rz_str_is_ascii(const char *str)
RZ_API void rz_str_remove_char(char *str, char c)
RZ_API const char * rz_str_lastbut(const char *s, char ch, const char *but)
static RZ_OWN char * rz_str_escape_(const char *buf, bool parse_esc_seq, bool ign_esc_seq, RzStrEscOptions *opt)
RZ_API bool rz_str_endswith_icase(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string ends with a specifc sequence of characters (case insensitive)
RZ_API bool rz_str_endswith(RZ_NONNULL const char *str, RZ_NONNULL const char *needle)
Checks if a string ends with a specifc sequence of characters (case sensitive)
RZ_API wchar_t * rz_str_mb_to_wc_l(const char *buf, int len)
static const char * word_get_first(const char *text)
RZ_API void rz_str_argv_free(char **argv)
RZ_API char * rz_str_list_join(RzList *str, const char *sep)
RZ_API void rz_str_reverse(char *str)
RZ_API void rz_str_sanitize(char *c)
RZ_API char * rz_str_nextword(char *s, char ch)
RZ_API const char * rz_str_sysbits(const int v)
RZ_API char * rz_str_from_ut64(ut64 val)
RZ_API const char * rz_str_closer_chr(const char *b, const char *s)
RZ_API RZ_OWN char * rz_str_stringify_raw_buffer(RzStrStringifyOpt *option, RZ_NULLABLE RZ_OUT ut32 *length)
Converts a raw buffer to a printable string based on the selected options.
RZ_API const char * rz_str_nstr(const char *s, const char *find, int slen)
RZ_API size_t rz_str_split(char *str, char ch)
Split string str in place by using ch as a delimiter.
RZ_API int rz_str_write(int fd, const char *b)
RZ_API char * rz_str_arg_escape(const char *arg)
RZ_API char * rz_str_escape_sh(const char *buf)
Group together some common options used by string escaping functions.
bool esc_bslash
When true, backslashes \ are quoted with \\
bool show_asciidot
When true, dots . are placed instead of unprintable characters.
bool esc_double_quotes
When true, double quotes "</tt> are quoted with <tt>\\"
bool dot_nl
When true, is converted into the graphiz-compatible newline \l.
ut64(WINAPI *w32_GetEnabledXStateFeatures)()
static const z80_opcode fd[]