scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 6183f157e94dee4dd7ae776c621012e18a8da7ef
parent 5623808ee73aea1ceffcf3503def2ec3f4773e1a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Fri, 17 Feb 2017 09:24:43 +0100

[libc] Add strcoll()

We only support C locale, so strcoll() is equivalent to strcmp()

Diffstat:
Mlibc/src/Makefile | 2+-
Alibc/src/strcoll.c | 11+++++++++++
2 files changed, 12 insertions(+), 1 deletion(-)

diff --git 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 diff --git a/libc/src/strcoll.c b/libc/src/strcoll.c @@ -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; +}