home *** CD-ROM | disk | FTP | other *** search
/ GEMini Atari / GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso / zip / gnu / mntlib16.lzh / MNTLIB16 / STRDUP.C < prev    next >
C/C++ Source or Header  |  1993-07-29  |  305b  |  21 lines

  1. /*
  2.  * strdup: return a duplicate of a string
  3.  * Written by Eric R. Smith and placed in the public domain.
  4.  */
  5.  
  6. #include <stdlib.h>
  7. #include <string.h>
  8. #undef strdup
  9.  
  10. char *
  11. strdup(s)
  12.     const char *s;
  13. {
  14.     char *dup;
  15.  
  16.     dup = malloc(strlen(s)+1);
  17.     if (dup)
  18.         strcpy(dup, s);
  19.     return dup;
  20. }
  21.