xref: /freebsd/contrib/ntp/libntp/strdup.c (revision b52b9d56d4e96089873a75f9e29062eec19fabba)
1 
2 #define NULL 0
3 
4 char *
5 strdup(
6 	const char *s
7 	)
8 {
9         char *cp;
10 
11         if (s) {
12                 cp = (char *) malloc((unsigned) (strlen(s)+1));
13                 if (cp) {
14                         (void) strcpy(cp, s);
15 		}
16         } else {
17                 cp = (char *) NULL;
18 	}
19         return(cp);
20 }
21