summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2001-03-15 19:30:26 +0000
committerEric Andersen <andersen@codepoet.org>2001-03-15 19:30:26 +0000
commit11a46906d0adb2405167330930b1af139991ec3e (patch)
treeba9485129b970eb3fa0394f9d9ecb523b9b021d6 /libc
parent22b68ede21b6d91f801e33edc6ed5397809644f9 (diff)
Add index and rindex
Diffstat (limited to 'libc')
-rw-r--r--libc/string/Makefile2
-rw-r--r--libc/string/string.c14
2 files changed, 15 insertions, 1 deletions
diff --git a/libc/string/Makefile b/libc/string/Makefile
index 6823f2759..becd201bd 100644
--- a/libc/string/Makefile
+++ b/libc/string/Makefile
@@ -27,7 +27,7 @@ LIBC=$(TOPDIR)libc.a
MSRC=string.c
MOBJ=strlen.o strcat.o strcpy.o strchr.o strcmp.o strncat.o strncpy.o \
strncmp.o strrchr.o strdup.o memcpy.o memccpy.o memset.o \
- memmove.o memcmp.o memchr.o ffs.o strnlen.o
+ memmove.o memcmp.o memchr.o ffs.o strnlen.o index.o rindex.o
MSRC1=index.c
MOBJ1=index.o rindex.o
diff --git a/libc/string/string.c b/libc/string/string.c
index 29ac83a24..2a689ccef 100644
--- a/libc/string/string.c
+++ b/libc/string/string.c
@@ -151,6 +151,13 @@ char *strchr(const char *str, int c)
}
#endif
+#ifdef L_index
+char *index (const char *s, int c)
+{
+ return( strchr(s, c));
+}
+#endif
+
/********************** Function strrchr ************************************/
#ifdef L_strrchr
@@ -172,6 +179,13 @@ char *strrchr(const char *str, int c)
}
#endif
+#ifdef L_rindex
+char *rindex (const char *s, int c)
+{
+ return( strrchr(s, c));
+}
+#endif
+
/********************** Function strdup ************************************/
#ifdef L_strdup