2 #include "lib/stkstring.h"
7 stk_array_len(char **s, uns cnt)
16 stk_array_join(char *x, char **s, uns cnt, uns sep)
31 static int stk_printf_len;
34 stk_printf_internal(char *fmt, ...)
40 stk_printf_buf = xmalloc(256);
46 int l = vsnprintf(stk_printf_buf, stk_printf_len, fmt, args2);
50 else if (l < stk_printf_len)
56 stk_printf_len = MAX(stk_printf_len*2, l+1);
57 stk_printf_buf = xrealloc(stk_printf_buf, stk_printf_len);
62 stk_hexdump_internal(char *dst, byte *src, uns n)
64 for (uns i=0; i<n; i++)
68 dst += sprintf(dst, "%02x", *src++);
77 char *a = stk_strndup("are!",3);
78 a = stk_strcat(a, " the ");
79 a = stk_strmulticat(a, stk_strdup("Jabberwock, "), "my", NULL);
80 char *arr[] = { a, " son" };
81 a = stk_strarraycat(arr, 2);
82 a = stk_printf("Bew%s!", a);
84 puts(stk_hexdump(a, 3));
85 char *ary[] = { "The", "jaws", "that", "bite" };
86 puts(stk_strjoin(ary, 4, ' '));