nano

nano with my custom patches
git clone git://bsandro.tech/nano
Log | Files | Refs | README | LICENSE

commit fcda76f684045787d9b1af94718252ae0005aa39
parent 639f37669ac2afc29f2ccd2cf44d5a8ebbb5a1fd
Author: Benno Schulenberg <bensberg@telfort.nl>
Date:   Fri, 13 Mar 2020 11:43:31 +0100

build: restore non-UTF8 fallbacks, to allow compiling with --disable-utf8

Commits b2c63c3d and 004af03e from yesterday mistakenly removed those
calls.

Diffstat:
Msrc/chars.c | 16++++++++++++++++
1 file changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/chars.c b/src/chars.c @@ -47,28 +47,37 @@ bool using_utf8(void) /* Return TRUE when the given character is some kind of letter. */ bool is_alpha_char(const char *c) { +#ifdef ENABLE_UTF8 wchar_t wc; if (mbtowc(&wc, c, MAXCHARLEN) < 0) return FALSE; return iswalpha(wc); +#else + return isalpha((unsigned char)*c); +#endif } /* Return TRUE when the given character is some kind of letter or a digit. */ bool is_alnum_char(const char *c) { +#ifdef ENABLE_UTF8 wchar_t wc; if (mbtowc(&wc, c, MAXCHARLEN) < 0) return FALSE; return iswalnum(wc); +#else + return isalnum((unsigned char)*c); +#endif } /* Return TRUE when the given character is space or tab or other whitespace. */ bool is_blank_char(const char *c) { +#ifdef ENABLE_UTF8 wchar_t wc; if ((signed char)*c >= 0) @@ -78,6 +87,9 @@ bool is_blank_char(const char *c) return FALSE; return iswblank(wc); +#else + return isblank((unsigned char)*c); +#endif } /* Return TRUE when the given character is a control character. */ @@ -95,12 +107,16 @@ bool is_cntrl_char(const char *c) /* Return TRUE when the given character is a punctuation character. */ bool is_punct_char(const char *c) { +#ifdef ENABLE_UTF8 wchar_t wc; if (mbtowc(&wc, c, MAXCHARLEN) < 0) return FALSE; return iswpunct(wc); +#else + return ispunct((unsigned char)*c); +#endif } /* Return TRUE when the given character is word-forming (it is alphanumeric or