home *** CD-ROM | disk | FTP | other *** search
/ Crawly Crypt Collection 2 / crawlyvol2.bin / program / c / plstsrc / tcstuff / strdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1988-12-18  |  258 b   |  16 lines

  1. #include <stdio.h>
  2. #include <string.h>
  3. #include <stdlib.h>
  4. char *strdup(char *s)
  5. {
  6. int len;
  7. char *adr;
  8.    if (s == 0)
  9.       return(0);
  10.    len = strlen(s);
  11.    if ((adr = malloc(len+1)) == 0)
  12.       return(0);
  13.    strcpy(adr,s);
  14.    return(adr);
  15. }
  16.