copy from intranet.
This commit is contained in:
19
libopts/compat/strdup.c
Normal file
19
libopts/compat/strdup.c
Normal file
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
Reference in New Issue
Block a user