aboutsummaryrefslogtreecommitdiff
path: root/src/lib9/strdup.c
blob: 5c67f0b60f428adc931babf5b95007db8c7b67dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#include <u.h>
#include <libc.h>

char*
strdup(char *s)
{
	char *t;
	int l;

	l = strlen(s);
	t = malloc(l+1);
	if(t == nil)
		return nil;
	memmove(t, s, l+1);
	return t;
}