home *** CD-ROM | disk | FTP | other *** search
/ The Datafile PD-CD 5 / DATAFILE_PDCD5.iso / utilities / p / python / pytexdoc / ext / source / !Python / Monty / c / strdup < prev    next >
Encoding:
Text File  |  1996-11-06  |  321 b   |  20 lines

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