$NetBSD: patch-ab,v 1.2 2004/07/06 20:36:58 bouyer Exp $ --- src/dfa.c.orig 2001-09-26 18:57:55.000000000 +0200 +++ src/dfa.c 2004-07-06 22:33:02.000000000 +0200 @@ -44,7 +44,7 @@ # include #endif -#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC +#if defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H && defined HAVE_MBRTOWC && defined HAVE_WCTYPE /* We can handle multibyte string. */ # define MBS_SUPPORT #endif @@ -1052,12 +1052,17 @@ setbit_case_fold (c, ccl); } else { /* POSIX locales are painful - leave the decision to libc */ - char expr[6] = { '[', c, '-', c2, ']', '\0' }; + char expr[6] = { '[', '\0', '-', '\0', ']', '\0' }; regex_t re; + + expr[1] = c; + expr[3] = c2; if (regcomp (&re, expr, case_fold ? REG_ICASE : 0) == REG_NOERROR) { for (c = 0; c < NOTCHAR; ++c) { - char buf[2] = { c, '\0' }; + char buf[2] = { '\0', '\0' }; regmatch_t mat; + + buf[0] = c; if (regexec (&re, buf, 1, &mat, 0) == REG_NOERROR && mat.rm_so == 0 && mat.rm_eo == 1) setbit_case_fold (c, ccl);