shithub: scc

Download patch

ref: e07e7027cc5f2fa8ae504f45311667974fe9a3bd
parent: 4c642e3e66899c12f4de7e7bda7f2b96e122b342
author: Roberto E. Vargas Caballero <[email protected]>
date: Thu Feb 16 16:05:39 EST 2017

[libc] Add strcmp()

--- a/libc/src/Makefile
+++ b/libc/src/Makefile
@@ -1,7 +1,7 @@
 # See LICENSE file for copyright and license details.
 .POSIX:
 
-LIBCOBJ = assert.o strcpy.o
+LIBCOBJ = assert.o strcpy.o strcmp.o
 
 libc.a: $(LIBCOJB)
 	ar $(ARFLAGS) $@ $?
--- /dev/null
+++ b/libc/src/strcmp.c
@@ -1,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+
+#include <string.h>
+
+int
+strcmp(const char *s1, const char *s2)
+{
+	while (*s1 && *s2 && *s1 != *s2)
+		++s1, ++s2;
+	return *s1 - *s2;
+}