strdup.c

Go to the documentation of this file.
00001 /*
00002 lib/other/strdup.c
00003 */
00004 
00005 #include <stdlib.h>
00006 #include <string.h>
00007 
00008 char *strdup(s1)
00009 const char *s1;
00010 {
00011         size_t len;
00012         char *s2;
00013 
00014         len= strlen(s1)+1;
00015 
00016         s2= malloc(len);
00017         if (s2 == NULL)
00018                 return NULL;
00019         strcpy(s2, s1);
00020 
00021         return s2;
00022 }
00023 

Generated on Fri Apr 14 22:57:27 2006 for minix by  doxygen 1.4.6