home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / py2s152.zip / Python / strdup.c < prev    next >
C/C++ Source or Header  |  1999-06-27  |  277b  |  16 lines

  1. /* strdup() replacement (from stdwin, if you must know) */
  2.  
  3. #include "pgenheaders.h"
  4.  
  5. char *
  6. strdup(str)
  7.     const char *str;
  8. {
  9.     if (str != NULL) {
  10.         register char *copy = malloc(strlen(str) + 1);
  11.         if (copy != NULL)
  12.             return strcpy(copy, str);
  13.     }
  14.     return NULL;
  15. }
  16.