/* * a l l s t r . c */ /*)LIBRARY */ #ifdef DOCUMENTATION title allstr Allocate a Copy of a String index allocate a Copy of a string synopsis char * allstr(s) char *s; /* string to be duplicated */ description allstr() Allocates memory for a copy of the string s, and returns a pointer to the new string. bugs author Machiavelli Systems #endif char *allstr(s) /* allocate a copy of a string using zmalloc() */ char *s; { char *wheritis; /* allocate enough memory for the string plus a null */ wheritis = zmalloc(strlen(s)+1); /* put a copy of the string into the memory just allocated */ strcpy(wheritis,s); /* the user needs to know where his new string is */ return(wheritis); }