home *** CD-ROM | disk | FTP | other *** search
/ vsiftp.vmssoftware.com / VSIPUBLIC@vsiftp.vmssoftware.com.tar / FREEWARE / FREEWARE40.ZIP / xjig / vms_strdup.c < prev    next >
C/C++ Source or Header  |  1997-12-30  |  409b  |  23 lines

  1. /*
  2.  * strdup.c
  3.  *
  4.  * Simple version of strdup for machines without it (ie DEC Ultrix 4.2)
  5.  *
  6.  * By David Chatterton
  7.  * 29 July 1993
  8.  *
  9.  * You can do anything you like to this... :)
  10.  * I've stolen it from xpilot and added it to the xvmstuils MPJZ ;-)
  11.  */
  12.  
  13. #include <stdlib.h>
  14. #include <string.h>
  15.  
  16. char* strdup (const char* s1)
  17. {
  18.     char* s2;
  19.     if (s2 = (char*)malloc(strlen(s1)+1))
  20.         strcpy(s2,s1);
  21.     return s2;
  22. }
  23.