diff options
Diffstat (limited to 'lib/string/strcmp.c')
| -rw-r--r-- | lib/string/strcmp.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/string/strcmp.c b/lib/string/strcmp.c new file mode 100644 index 0000000..afcb1b7 --- /dev/null +++ b/lib/string/strcmp.c @@ -0,0 +1,10 @@ +/* SPDX-License-Identifier: MIT */ +/* Derived from musl libc (Copyright © 2005-2020 Rich Felker, et al.) */ + +#include <string.h> + +int strcmp(const char *l, const char *r) +{ + for (; *l==*r && *l; l++, r++); + return *(unsigned char *)l - *(unsigned char *)r; +} |
