kern
changeset 67:ebca81749ef5
added strcmp
author | John Tsiombikas <nuclear@mutantstargoat.com> |
---|---|
date | Sun, 09 Oct 2011 20:38:35 +0300 |
parents | 637efe95d0d1 |
children | 0a205396e1a0 |
files | src/klibc/string.c src/klibc/string.h |
diffstat | 2 files changed, 11 insertions(+), 0 deletions(-) [+] |
line diff
1.1 --- a/src/klibc/string.c Thu Oct 06 04:28:21 2011 +0300 1.2 +++ b/src/klibc/string.c Sun Oct 09 20:38:35 2011 +0300 1.3 @@ -88,3 +88,12 @@ 1.4 } 1.5 return 0; 1.6 } 1.7 + 1.8 +int strcmp(const char *s1, const char *s2) 1.9 +{ 1.10 + while(*s1 && *s1 == *s2) { 1.11 + s1++; 1.12 + s2++; 1.13 + } 1.14 + return *s1 - *s2; 1.15 +}
2.1 --- a/src/klibc/string.h Thu Oct 06 04:28:21 2011 +0300 2.2 +++ b/src/klibc/string.h Sun Oct 09 20:38:35 2011 +0300 2.3 @@ -14,4 +14,6 @@ 2.4 char *strchr(const char *s, int c); 2.5 char *strrchr(const char *s, int c); 2.6 2.7 +int strcmp(const char *s1, const char *s2); 2.8 + 2.9 #endif /* STRING_H_ */