X-Git-Url: https://pd.if.org/git/?p=zos;a=blobdiff_plain;f=klib%2Fstrcmp.c;fp=klib%2Fstrcmp.c;h=6d46c95244d039df02f499acd076a0ee6baa1eb4;hp=0000000000000000000000000000000000000000;hb=5c0e560e481e2e97b793f7574e849a5882781df9;hpb=e57b692bd3a86ee40fd89416a06fd696f1ff3bf9 diff --git a/klib/strcmp.c b/klib/strcmp.c new file mode 100644 index 0000000..6d46c95 --- /dev/null +++ b/klib/strcmp.c @@ -0,0 +1,9 @@ +#include + +int strcmp(const char *s1, const char *s2) { + while ( *s1 && (*s1 == *s2) ) { + ++s1; + ++s2; + } + return *(unsigned char *)s1 - *(unsigned char *)s2; +}