[hackers] [scc] [libc] Add strcoll() || Roberto E. Vargas Caballero
commit 6183f157e94dee4dd7ae776c621012e18a8da7ef
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Fri Feb 17 09:24:43 2017 +0100
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Fri Feb 17 09:24:43 2017 +0100
[libc] Add strcoll()
We only support C locale, so strcoll() is equivalent to strcmp()
diff --git a/libc/src/Makefile b/libc/src/Makefile
index 3425b29..e4a51b7 100644
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
_AT_@ -2,7 +2,7 @@
.POSIX:
LIBCOBJ = assert.o strcpy.o strcmp.o strlen.o strchr.o \
- strrchr.o strcat.o strncpy.o strncat.o \
+ strrchr.o strcat.o strncpy.o strncat.o strcoll.o \
memset.o memcpy.o memmove.o memcmp.o memchr.o
all: libc.a
diff --git a/libc/src/strcoll.c b/libc/src/strcoll.c
new file mode 100644
index 0000000..d914f5e
--- /dev/null
+++ b/libc/src/strcoll.c
_AT_@ -0,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <string.h>
+
+int
+strcoll(const char *s1, const char *s2)
+{
+ while (*s1 && *s2 && *s1 != *s2)
+ ++s1, ++s2;
+ return *s1 - *s2;
+}
Received on Fri Feb 17 2017 - 09:26:44 CET
This archive was generated by hypermail 2.3.0
: Fri Feb 17 2017 - 09:36:16 CET