wm: teppich

ref: becccca115f0f2c1f42f12fd891481bd8211eb44
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));
}