@@ -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
+ memmove.o memcmp.o memchr.o ffs.o strnlen.o
MSRC1=index.c
MOBJ1=index.o rindex.o
@@ -23,6 +23,16 @@ size_t strlen(const char *str)
}
#endif
+/********************** Function strnlen ************************************/
+
+#ifdef L_strnlen
+size_t strnlen (const char *string, size_t maxlen)
+{
+ const char *end = memchr (string, '\0', maxlen);
+ return end ? end - string : maxlen;
+}
+#endif
/********************** Function strcat ************************************/
#ifdef L_strcat