home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / EMXLIB8F.ZIP / EMX / LIB / STR / STRDUP.C < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-02  |  294 b   |  17 lines

  1. /* strdup.c (emx+gcc) -- Copyright (c) 1990-1993 by Eberhard Mattes */
  2.  
  3. #include <string.h>
  4. #include <stdlib.h>
  5.  
  6. char *strdup (const char *string)
  7. {
  8.   char *p;
  9.   size_t n;
  10.  
  11.   n = strlen (string) + 1;
  12.   p = malloc (n);
  13.   if (p != NULL)
  14.     memcpy (p, string, n);
  15.   return (p);
  16. }
  17.