From aa3d1b4689e6dadd982fe1e5ca8af69ca39c617d Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Wed, 15 Apr 2020 16:35:29 +0200 Subject: Added ext2 filesystem --- src/kernel/lib/string/strstr.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 src/kernel/lib/string/strstr.c (limited to 'src/kernel/lib/string/strstr.c') diff --git a/src/kernel/lib/string/strstr.c b/src/kernel/lib/string/strstr.c new file mode 100644 index 0000000..d58b4d5 --- /dev/null +++ b/src/kernel/lib/string/strstr.c @@ -0,0 +1,25 @@ +#include +#include + +char *strstr(const char *in, const char *str) +{ + char c; + uint32_t len; + + c = *str++; + if (!c) + return (char *)in; + + len = strlen(str); + do { + char sc; + + do { + sc = *in++; + if (!sc) + return (char *)0; + } while (sc != c); + } while (strncmp(in, str, len) != 0); + + return (char *)(in - 1); +} \ No newline at end of file -- cgit v1.2.3