aboutsummaryrefslogtreecommitdiffstats
path: root/test.c
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2011-11-21 20:51:19 -0500
committerChet Ramey <chet.ramey@case.edu>2011-11-21 20:51:19 -0500
commit0001803f0b9523c94fa2ede48eaecb047fef4524 (patch)
treef334332811e033ff966d94f6268f0629a94304b3 /test.c
parent89a92869e56aba4e4cab2d639c00a86f0545c862 (diff)
downloadandroid_external_bash-0001803f0b9523c94fa2ede48eaecb047fef4524.tar.gz
android_external_bash-0001803f0b9523c94fa2ede48eaecb047fef4524.tar.bz2
android_external_bash-0001803f0b9523c94fa2ede48eaecb047fef4524.zip
Bash-4.1 distribution source
Diffstat (limited to 'test.c')
-rw-r--r--test.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/test.c b/test.c
index ad634f9..180940c 100644
--- a/test.c
+++ b/test.c
@@ -65,8 +65,9 @@ extern int errno;
#endif
#if !defined (STREQ)
-# define STREQ(a, b) ((a)[0] == (b)[0] && strcmp (a, b) == 0)
+# define STREQ(a, b) ((a)[0] == (b)[0] && strcmp ((a), (b)) == 0)
#endif /* !STREQ */
+#define STRCOLLEQ(a, b) ((a)[0] == (b)[0] && strcoll ((a), (b)) == 0)
#if !defined (R_OK)
#define R_OK 4
@@ -375,12 +376,16 @@ binary_test (op, arg1, arg2, flags)
if (op[0] == '=' && (op[1] == '\0' || (op[1] == '=' && op[2] == '\0')))
return (patmatch ? patcomp (arg1, arg2, EQ) : STREQ (arg1, arg2));
-
else if ((op[0] == '>' || op[0] == '<') && op[1] == '\0')
- return ((op[0] == '>') ? (strcmp (arg1, arg2) > 0) : (strcmp (arg1, arg2) < 0));
-
+ {
+ if (shell_compatibility_level > 40 && flags & TEST_LOCALE)
+ return ((op[0] == '>') ? (strcoll (arg1, arg2) > 0) : (strcoll (arg1, arg2) < 0));
+ else
+ return ((op[0] == '>') ? (strcmp (arg1, arg2) > 0) : (strcmp (arg1, arg2) < 0));
+ }
else if (op[0] == '!' && op[1] == '=' && op[2] == '\0')
return (patmatch ? patcomp (arg1, arg2, NE) : (STREQ (arg1, arg2) == 0));
+
else if (op[2] == 't')
{