1
0

strdup.c 310 B

12345678910111213141516171819202122
  1. /*
  2. * Platforms without strdup ?!?!?!
  3. */
  4. static char *
  5. strdup( char const *s );
  6. static char *
  7. strdup( char const *s )
  8. {
  9. char *cp;
  10. if (s == NULL)
  11. return NULL;
  12. cp = (char *) AGALOC((unsigned) (strlen(s)+1), "strdup");
  13. if (cp != NULL)
  14. (void) strcpy(cp, s);
  15. return cp;
  16. }