From 6bc908e3e7cfb13d4277aaa35846f72fd9df337c Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Sun, 21 Dec 2025 23:10:02 -0500 Subject: usr: sdk: Add strcmp() to sdk/string.h + sources Signed-off-by: Ian Moffett --- usr/sdk/common/string/strcmp.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 usr/sdk/common/string/strcmp.c (limited to 'usr/sdk/common/string') 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 +#include + +int +strcmp(const char *s1, const char *s2) +{ + while (*s1 == *s2++) { + if (*s1++ == 0) { + return (0); + } + } + + return (*(UBYTE *)s1 - *(UBYTE *)--s2); +} -- cgit v1.2.3