diff options
Diffstat (limited to 'usr/sdk/common/string/strcmp.c')
| -rw-r--r-- | usr/sdk/common/string/strcmp.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/usr/sdk/common/string/strcmp.c b/usr/sdk/common/string/strcmp.c new file mode 100644 index 0000000..cb47cfb --- /dev/null +++ b/usr/sdk/common/string/strcmp.c @@ -0,0 +1,19 @@ +/* + * Copyright (c) 2025, Ian Moffett. + * Provided under the BSD-3 clause. + */ + +#include <sdk/string.h> +#include <sdk/types.h> + +int +strcmp(const char *s1, const char *s2) +{ + while (*s1 == *s2++) { + if (*s1++ == 0) { + return (0); + } + } + + return (*(UBYTE *)s1 - *(UBYTE *)--s2); +} |
