# HG changeset patch # User John Tsiombikas # Date 1318181915 -10800 # Node ID ebca81749ef5237ab7e891bdb4aa737d792aa5cc # Parent 637efe95d0d141157ff7dc1c00420298db68b3dc added strcmp diff -r 637efe95d0d1 -r ebca81749ef5 src/klibc/string.c --- a/src/klibc/string.c Thu Oct 06 04:28:21 2011 +0300 +++ b/src/klibc/string.c Sun Oct 09 20:38:35 2011 +0300 @@ -88,3 +88,12 @@ } return 0; } + +int strcmp(const char *s1, const char *s2) +{ + while(*s1 && *s1 == *s2) { + s1++; + s2++; + } + return *s1 - *s2; +} diff -r 637efe95d0d1 -r ebca81749ef5 src/klibc/string.h --- a/src/klibc/string.h Thu Oct 06 04:28:21 2011 +0300 +++ b/src/klibc/string.h Sun Oct 09 20:38:35 2011 +0300 @@ -14,4 +14,6 @@ char *strchr(const char *s, int c); char *strrchr(const char *s, int c); +int strcmp(const char *s1, const char *s2); + #endif /* STRING_H_ */