aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/lib/string/strdup.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/lib/string/strdup.c')
-rw-r--r--src/kernel/lib/string/strdup.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/kernel/lib/string/strdup.c b/src/kernel/lib/string/strdup.c
new file mode 100644
index 0000000..9330144
--- /dev/null
+++ b/src/kernel/lib/string/strdup.c
@@ -0,0 +1,10 @@
+#include <kernel/lib/string.h>
+#include <kernel/lib/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