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