From d82b18c90710baf16239257272a740488fddf11c Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Sun, 22 Nov 2020 19:22:31 +0100 Subject: Added file-based HTTP server And fixed/added some other things --- libc/str.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'libc/str.c') diff --git a/libc/str.c b/libc/str.c index d1ee325..7f6d782 100644 --- a/libc/str.c +++ b/libc/str.c @@ -24,6 +24,16 @@ char *strcpy(char *dst, const char *src) return dst; } +char *strncpy(char *dst, const char *src, u32 n) +{ + char *q = dst; + + while (n-- && (*dst++ = *src++)) + ; + + return q; +} + int strcmp(const char *s1, const char *s2) { const u8 *c1 = (const u8 *)s1; @@ -73,6 +83,12 @@ char *strcat(char *dst, const char *src) return dst; } +char *strncat(char *dst, const char *src, u32 n) +{ + strncpy(strchr(dst, '\0'), src, n); + return dst; +} + char *strinv(char *s) { u32 s_str = strlen(s); -- cgit v1.2.3