ref: 2dc97a631e2747f24fc292f1158c6dbff9cd05e3 dir: /libc/strdup.c/
#include <u.h> #include <libc.h> #include <mem.h> char* strdup(char *s) { char *dup; dup = malloc(strlen(s) + 1); /* s + \0 */ return strncpy(s, dup, strlen(s)); }