xref: /plan9-contrib/sys/src/ape/lib/ap/gen/strdup.c (revision 781103c4074deb8af160e8a0da2742ba6b29dc2b)
1 #include <string.h>
2 #include <ctype.h>
3 #include <stdlib.h>
4 
5 char*
6 strdup(char *p)
7 {
8 	int n;
9 	char *np;
10 
11 	n = strlen(p)+1;
12 	np = malloc(n);
13 	if(np)
14 		memmove(np, p, n);
15 	return np;
16 }
17