mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-29 08:52:46 +00:00
21 lines
306 B
C
21 lines
306 B
C
|
|
#define NULL 0
|
|
|
|
char *
|
|
strdup(
|
|
const char *s
|
|
)
|
|
{
|
|
char *cp;
|
|
|
|
if (s) {
|
|
cp = (char *) malloc((unsigned) (strlen(s)+1));
|
|
if (cp) {
|
|
(void) strcpy(cp, s);
|
|
}
|
|
} else {
|
|
cp = (char *) NULL;
|
|
}
|
|
return(cp);
|
|
}
|