xref: /plan9-contrib/sys/src/libc/port/strdup.c (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 #include <u.h>
2 #include <libc.h>
3 
4 char*
5 strdup(char *s)
6 {
7 	char *os;
8 
9 	os = malloc(strlen(s) + 1);
10 	if(os == 0)
11 		return 0;
12 	return strcpy(os, s);
13 }
14