From 4b178c0feb4c415be36be0e4c0def8c447ed42af Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Fri, 22 Nov 2019 22:17:54 +0100 Subject: Added the most awesome c lib --- src/mlibc/string/strdup.c | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 src/mlibc/string/strdup.c (limited to 'src/mlibc/string/strdup.c') diff --git a/src/mlibc/string/strdup.c b/src/mlibc/string/strdup.c new file mode 100644 index 0000000..0cddd79 --- /dev/null +++ b/src/mlibc/string/strdup.c @@ -0,0 +1,9 @@ +#include +#include + +char *strdup(const char *orig) { + size_t s_orig = strlen(orig); + char *ret = kmalloc(s_orig + 1); + strcpy(ret, orig); + return ret; +} \ No newline at end of file -- cgit v1.2.3