home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 15 / AACD15.ISO / AACD / Programming / Python2 / Python20_source / Python / strdup.c < prev    next >
Encoding:
C/C++ Source or Header  |  2000-10-25  |  256 b   |  15 lines

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