I have tried to compile grep 2.7 on a system that has no multi byte support at all. The build failed because prepare_wc_buf is outside the #if MBS_SUPPORT section. The small patch below will fix the issue.
Regards, Juan M. Guerrero 2010-09-30 Juan Manuel Guerrero <[email protected]> * src/dfa.c [MBS_SUPPORT]: Compile prepare_wc_buf only if MBS_SUPPORT has been defined. diff -aprNU5 grep-2.7.orig/src/dfa.c grep-2.7/src/dfa.c --- grep-2.7.orig/src/dfa.c 2010-09-16 09:32:24 +0000 +++ grep-2.7/src/dfa.c 2010-09-30 17:42:50 +0000 @@ -3120,14 +3120,11 @@ transit_state (struct dfa *d, int s, uns free(match_lens); free(follows.elems); return s1; } -#endif /* MBS_SUPPORT */ - /* Initialize mblen_buf and inputwcs with data from the next line. */ - static void prepare_wc_buf (const char *begin, const char *end) { unsigned char eol = eolbyte; size_t remain_bytes, i; @@ -3169,10 +3166,12 @@ prepare_wc_buf (const char *begin, const buf_end = (unsigned char *) (begin + i); mblen_buf[i] = 0; inputwcs[i] = 0; /* sentinel */ } +#endif /* MBS_SUPPORT */ + /* Search through a buffer looking for a match to the given struct dfa. Find the first occurrence of a string matching the regexp in the buffer, and the shortest possible version thereof. Return a pointer to the first character after the match, or NULL if none is found. BEGIN points to the beginning of the buffer, and END points to the first byte
