summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
Diffstat (limited to 'posix')
-rwxr-xr-xposix/globtest.sh14
-rw-r--r--posix/regex.c13
2 files changed, 13 insertions, 14 deletions
diff --git a/posix/globtest.sh b/posix/globtest.sh
index 12635b76d9..806b481c7e 100755
--- a/posix/globtest.sh
+++ b/posix/globtest.sh
@@ -7,7 +7,7 @@ rtld_installed_name=$1; shift
 # We have to find the libc and the NSS modules.
 library_path=${common_objpfx}:${common_objpfx}nss:${common_objpfx}nis
 
-# Since we use `osrt' we must make sure to use the same locale everywhere.
+# Since we use `sort' we must make sure to use the same locale everywhere.
 LC_ALL=C
 export LC_ALL
 LANG=C
@@ -17,9 +17,8 @@ export LANG
 : ${TMPDIR=/tmp}
 testdir=$TMPDIR/globtest-dir
 testout=$TMPDIR/globtest-out
-testout2=$TMPDIR/globtest-out2
 
-trap 'rm -fr $testdir $testout $testout2' 1 2 3 15
+trap 'rm -fr $testdir $testout' 1 2 3 15
 
 rm -fr $testdir
 mkdir $testdir
@@ -197,22 +196,19 @@ EOF
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 ${common_objpfx}posix/globtest -q -t "$testdir" "~" |
 sort >$testout
-echo ~ > $testout2
-cmp $testout2 $testout || result=1
+echo ~ | cmp - $testout || result=1
 
 # Test tilde expansion with trailing slash
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 ${common_objpfx}posix/globtest -q -t "$testdir" "~/" |
 sort > $testout
-echo ~/ > $testout2
-cmp $testout2 $testout || result=1
+echo ~/ | cmp - $testout || result=1
 
 # Test tilde expansion with username
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
 ${common_objpfx}posix/globtest -q -t "$testdir" "~"$USER |
 sort > $testout
-eval echo ~$USER > $testout2
-cmp $testout2 $testout || result=1
+eval echo ~$USER | cmp - $testout || result=1
 
 # Tilde expansion shouldn't match a file
 ${elf_objpfx}${rtld_installed_name} --library-path ${library_path} \
diff --git a/posix/regex.c b/posix/regex.c
index 484e13d799..0543433fbe 100644
--- a/posix/regex.c
+++ b/posix/regex.c
@@ -46,9 +46,12 @@
 # include <sys/types.h>
 #endif
 
+#define WIDE_CHAR_SUPPORT \
+  defined _LIBC || (HAVE_WCTYPE_H && HAVE_WCHAR_H && HAVE_BTOWC)
+
 /* For platform which support the ISO C amendement 1 functionality we
    support user defined character classes.  */
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if WIDE_CHAR_SUPPORT
 /* Solaris 2.5 has a bug: <wchar.h> must be included before <wctype.h>.  */
 # include <wchar.h>
 # include <wctype.h>
@@ -1716,7 +1719,7 @@ typedef struct
        } 								\
     }
 
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if WIDE_CHAR_SUPPORT
 /* The GNU C library provides support for user-defined character classes
    and the functions from ISO C amendement 1.  */
 # ifdef CHARCLASS_NAME_MAX
@@ -2220,7 +2223,7 @@ regex_compile (pattern, size, syntax, bufp)
                        the leading `:' and `[' (but set bits for them).  */
                     if (c == ':' && *p == ']')
                       {
-#if defined _LIBC || (defined HAVE_WCTYPE_H && defined HAVE_WCHAR_H)
+#if WIDE_CHAR_SUPPORT
                         boolean is_lower = STREQ (str, "lower");
                         boolean is_upper = STREQ (str, "upper");
 			wctype_t wt;
@@ -2241,10 +2244,10 @@ regex_compile (pattern, size, syntax, bufp)
 # ifdef _LIBC
 			    if (__iswctype (__btowc (ch), wt))
 			      SET_LIST_BIT (ch);
-#else
+# else
 			    if (iswctype (btowc (ch), wt))
 			      SET_LIST_BIT (ch);
-#endif
+# endif
 
 			    if (translate && (is_upper || is_lower)
 				&& (ISUPPER (ch) || ISLOWER (ch)))