home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume39 / rperf / part01 / strdup.c < prev   
Encoding:
C/C++ Source or Header  |  1993-08-30  |  707 b   |  36 lines

  1. #ifndef lint
  2. static char    *RCSid = "$Header: /src/common/usc/lib/libgen/RCS/strdup.c,v 1.2 1992/04/16 01:28:02 mcooper Exp $";
  3. #endif
  4.  
  5. /*
  6.  * $Log: strdup.c,v $ Revision 1.2  1992/04/16  01:28:02  mcooper Some
  7.  * de-linting.
  8.  * 
  9.  * Revision 1.2  1992/04/16  01:28:02  mcooper Some de-linting.
  10.  * 
  11.  * Revision 1.1  1992/03/21  02:48:11  mcooper Initial revision
  12.  * 
  13.  */
  14.  
  15.  
  16. #include <stdio.h>
  17.  
  18. /*
  19.  * Most systems don't have this (yet)
  20.  */
  21. char           *
  22. strdup(str)
  23.     char           *str;
  24. {
  25.     char           *p;
  26.     extern char    *malloc();
  27.     extern char    *strcpy();
  28.  
  29.     if ((p = malloc((unsigned) strlen(str) + 1)) == NULL)
  30.     return ((char *) NULL);
  31.  
  32.     (void) strcpy(p, str);
  33.  
  34.     return (p);
  35. }
  36.