ref: 79fa0e66f2a16cbc6ba50641794e69f44fc6d2ac
parent: 38237dc6cf5af3058d4935300d75410f68cf1810
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Fri Feb 17 04:24:43 EST 2017
[libc] Add strcoll() We only support C locale, so strcoll() is equivalent to strcmp()
--- a/libc/src/Makefile
+++ b/libc/src/Makefile
@@ -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
--- /dev/null
+++ b/libc/src/strcoll.c
@@ -1,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;
+}