diff options
Diffstat (limited to 'libc/str.c')
-rw-r--r-- | libc/str.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -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); |