home *** CD-ROM | disk | FTP | other *** search
/ rtsi.com / 2014.01.www.rtsi.com.tar / www.rtsi.com / OS9 / OSK / ARCHIVERS / lha208src.lzh / LHA / SRC / strdup.c < prev    next >
Text File  |  1994-02-14  |  374b  |  29 lines

  1. /*
  2.  * strdup.c
  3.  */
  4.  
  5. #ifdef NOSTRDUP
  6.  
  7. #ifdef sony_news
  8. #include <sys/param.h>
  9. #define _SIZE_T
  10. #endif
  11. #if defined(__STDC__) || defined(NEWSOS)
  12. #include <stdlib.h>
  13. #endif
  14.  
  15. #ifndef NULL
  16. #define NULL (char *)0
  17. #endif
  18.  
  19. char *strdup ( buf )
  20. char *buf;
  21. {
  22.     char *p;
  23.  
  24.     if ((p = (char *)malloc(strlen(buf) + 1)) == NULL) return NULL;
  25.     strcpy( p, buf );
  26.     return p;
  27. }
  28. #endif
  29.