home *** CD-ROM | disk | FTP | other *** search
- /* > C.Strdup - save a string on the heap; return pointer to it */
-
- #include <string.h>
- #include <stddef.h>
- #include <stdlib.h>
- #include "utils.h"
-
- char *strdup (const char *str)
- {
- char *p = malloc(strlen(str)+1);
-
- if ( p == NULL )
- fatal(1,"Not enough memory to save string\n");
-
- return (strcpy(p,str));
- }
-