wm: teppich

ref: 6d069b39b5ff8118f7b719b8c9e33a03686b8811
dir: /libc/strdup.c/

View raw version
#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));
}