home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJLSR201.ZIP / src / libc / compat / string / strdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-28  |  295 b   |  17 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #include <string.h>
  3. #include <stdlib.h>
  4.  
  5. char *
  6. strdup(const char *_s)
  7. {
  8.   char *rv;
  9.   if (_s == 0)
  10.     return 0;
  11.   rv = (char *)malloc(strlen(_s) + 1);
  12.   if (rv == 0)
  13.     return 0;
  14.   strcpy(rv, _s);
  15.   return rv;
  16. }
  17.