Date: Fri, 3 Sep 2010 22:13:54 +0000 (UTC) From: Jilles Tjoelker <jilles@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r212190 - head/bin/sh Message-ID: <201009032213.o83MDsp5065901@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: jilles Date: Fri Sep 3 22:13:54 2010 New Revision: 212190 URL: http://svn.freebsd.org/changeset/base/212190 Log: 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. Modified: head/bin/sh/mksyntax.c Modified: head/bin/sh/mksyntax.c ============================================================================== --- head/bin/sh/mksyntax.c Fri Sep 3 21:59:12 2010 (r212189) +++ head/bin/sh/mksyntax.c Fri Sep 3 22:13:54 2010 (r212190) @@ -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 };
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201009032213.o83MDsp5065901>