NetBSD/dist/ntp/libopts/compat/strdup.c
2007-01-06 16:04:26 +00:00

22 lines
338 B
C

/* $NetBSD: strdup.c,v 1.1.1.1 2007/01/06 16:06:20 kardel Exp $ */
/*
* Platforms without strdup ?!?!?!
*/
static char *
strdup( char const *s )
{
char *cp;
if (s == NULL)
return NULL;
cp = (char *) AGALOC((unsigned) (strlen(s)+1), "strdup");
if (cp != NULL)
(void) strcpy(cp, s);
return cp;
}