diff options
author | jilles <jilles@FreeBSD.org> | 2010-09-03 22:13:54 +0000 |
---|---|---|
committer | jilles <jilles@FreeBSD.org> | 2010-09-03 22:13:54 +0000 |
commit | 642c71cb5d80533e263258f0efbc371e7cc02f5a (patch) | |
tree | 022a2974de65de8e55563b1326d6e3371aebcb2c /bin/sh | |
parent | 8d1940fec48b6da2d4b26c4da4d97917c9490196 (diff) | |
download | FreeBSD-src-642c71cb5d80533e263258f0efbc371e7cc02f5a.zip FreeBSD-src-642c71cb5d80533e263258f0efbc371e7cc02f5a.tar.gz |
sh: Do not use locale for determining if something is a name.
This makes it impossible to use locale-specific characters in variable
names.
Names containing locale-specific characters make scripts only work with the
correct locale setting. Also, they did not even work in many practical cases
because multibyte character sets such as utf-8 are not supported.
This also avoids weirdness if LC_CTYPE is changed in the middle of a script.
Diffstat (limited to 'bin/sh')
-rw-r--r-- | bin/sh/mksyntax.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/bin/sh/mksyntax.c b/bin/sh/mksyntax.c index 3f8ece8..e63f0d6 100644 --- a/bin/sh/mksyntax.c +++ b/bin/sh/mksyntax.c @@ -338,12 +338,12 @@ print(const char *name) */ static const char *macro[] = { - "#define is_digit(c)\t((is_type+SYNBASE)[c] & ISDIGIT)", + "#define is_digit(c)\t((is_type+SYNBASE)[(int)c] & ISDIGIT)", "#define is_eof(c)\t((c) == PEOF)", - "#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && isalpha((unsigned char) (c)))", - "#define is_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalpha((unsigned char) (c))))", - "#define is_in_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && ((c) == '_' || isalnum((unsigned char) (c))))", - "#define is_special(c)\t((is_type+SYNBASE)[c] & (ISSPECL|ISDIGIT))", + "#define is_alpha(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && (is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER))", + "#define is_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && (is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER))", + "#define is_in_name(c)\t(((c) < CTLESC || (c) > CTLQUOTEMARK) && (is_type+SYNBASE)[(int)c] & (ISUPPER|ISLOWER|ISUNDER|ISDIGIT))", + "#define is_special(c)\t((is_type+SYNBASE)[(int)c] & (ISSPECL|ISDIGIT))", NULL }; |