aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sh/strindex.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>2001-11-13 17:56:06 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:54 +0000
commitf73dda092b33638d2d5e9c35375f687a607b5403 (patch)
treef21584e70a444d6a1ecba0fb5e2cf79e8cce91db /lib/sh/strindex.c
parent28ef6c316f1aff914bb95ac09787a3c83c1815fd (diff)
downloadandroid_external_bash-f73dda092b33638d2d5e9c35375f687a607b5403.tar.gz
android_external_bash-f73dda092b33638d2d5e9c35375f687a607b5403.tar.bz2
android_external_bash-f73dda092b33638d2d5e9c35375f687a607b5403.zip
Imported from ../bash-2.05a.tar.gz.
Diffstat (limited to 'lib/sh/strindex.c')
-rw-r--r--lib/sh/strindex.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/lib/sh/strindex.c b/lib/sh/strindex.c
index 9d3f302..9172862 100644
--- a/lib/sh/strindex.c
+++ b/lib/sh/strindex.c
@@ -22,16 +22,11 @@
#include <config.h>
-#include "bashansi.h"
-#include <ctype.h>
+#include <bashansi.h>
+#include <chartypes.h>
#include <stdc.h>
-#ifndef to_upper
-# define to_upper(c) (islower(c) ? toupper(c) : (c))
-# define to_lower(c) (isupper(c) ? tolower(c) : (c))
-#endif
-
/* Determine if s2 occurs in s1. If so, return a pointer to the
match in s1. The compare is case insensitive. This is a
case-insensitive strstr(3). */
@@ -42,11 +37,11 @@ strindex (s1, s2)
{
register int i, l, len, c;
- c = to_upper (s2[0]);
+ c = TOLOWER ((unsigned char)s2[0]);
len = strlen (s1);
l = strlen (s2);
for (i = 0; (len - i) >= l; i++)
- if ((to_upper (s1[i]) == c) && (strncasecmp (s1 + i, s2, l) == 0))
+ if ((TOLOWER ((unsigned char)s1[i]) == c) && (strncasecmp (s1 + i, s2, l) == 0))
return ((char *)s1 + i);
return ((char *)0);
}