home *** CD-ROM | disk | FTP | other *** search
/ Aminet 7 / Aminet 7 - August 1995.iso / Aminet / text / hyper / ADtoHT2_1.lha / Source.lha / MyLib.lha / string / strdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-05  |  298 b   |  19 lines

  1. #include <string.h>
  2. #include <stdlib.h>
  3.  
  4. /************************************************************************/
  5.  
  6. #undef strdup
  7.  
  8. char *strdup(const char *String)
  9.  
  10. {
  11.   char *NewString;
  12.  
  13.   if ((NewString=malloc(strlen(String)+1)))
  14.     {
  15.       strcpy(NewString,String);
  16.     }
  17.   return NewString;
  18. }
  19.