home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume26 / sysinfo-1.0 / part01 / strdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-04-10  |  684 b   |  38 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 $
  7.  * Revision 1.2  1992/04/16  01:28:02  mcooper
  8.  * Some de-linting.
  9.  *
  10.  * Revision 1.2  1992/04/16  01:28:02  mcooper
  11.  * Some de-linting.
  12.  *
  13.  * Revision 1.1  1992/03/21  02:48:11  mcooper
  14.  * Initial revision
  15.  *
  16.  */
  17.  
  18.  
  19. #include <stdio.h>
  20.  
  21. /*
  22.  * Most systems don't have this (yet)
  23.  */
  24. char *strdup(str)
  25.      char *str;
  26. {
  27.     char                *p;
  28.     extern char               *malloc();
  29.     extern char               *strcpy();
  30.  
  31.     if ((p = malloc(strlen(str)+1)) == NULL)
  32.     return((char *) NULL);
  33.  
  34.     (void) strcpy(p, str);
  35.  
  36.     return(p);
  37. }
  38.