diff options
Diffstat (limited to 'libopts/compat/strdup.c')
-rw-r--r-- | libopts/compat/strdup.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/libopts/compat/strdup.c b/libopts/compat/strdup.c new file mode 100644 index 0000000..e2933a8 --- /dev/null +++ b/libopts/compat/strdup.c @@ -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; +} |