diff options
Diffstat (limited to 'src/mlibc/string/strdup.c')
-rw-r--r-- | src/mlibc/string/strdup.c | 9 |
1 files changed, 9 insertions, 0 deletions
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 <mlibc/string.h> +#include <mlibc/stdlib.h> + +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 |