summaryrefslogtreecommitdiffstats
path: root/src/util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util.c')
-rw-r--r--src/util.c43
1 files changed, 0 insertions, 43 deletions
diff --git a/src/util.c b/src/util.c
index b4d546d..7e1fa8e 100644
--- a/src/util.c
+++ b/src/util.c
@@ -9,53 +9,10 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <wchar.h>
-#include <wctype.h>
static const char *allowed = "abcdefghijklmnopqrstuvwxyz"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.:,;-_(){}[]";
-int
-strnwidth(const char *s, int n)
-{
- mbstate_t shift_state;
- wchar_t wc;
- size_t wc_len;
- size_t width = 0;
-
- memset(&shift_state, '\0', sizeof shift_state);
-
- for (size_t i = 0; i < n; i += wc_len) {
- wc_len = mbrtowc(&wc, s + i, MB_CUR_MAX, &shift_state);
- if (!wc_len) {
- break;
- } else if (wc_len >= (size_t)-2) {
- width += MIN(n - 1, strlen(s + i));
- break;
- } else {
- width += iswcntrl(wc) ? 2 : MAX(0, wcwidth(wc));
- }
- }
-
-done:
- return width;
-}
-
-const wchar_t *
-wcscasestr(const wchar_t *haystack, const wchar_t *needle)
-{
- int hslen, nlen, i;
-
- nlen = wcslen(needle);
- hslen = wcslen(haystack) - nlen;
- for (i = 0; i < hslen; i++) {
- if (!wcsncasecmp(haystack + i, needle, nlen))
- return haystack + i;
- }
-
- return NULL;
-}
-
void
panic(const char *file, int line, const char *msg, ...)
{