static char rcsid[] = "$Id: savestr.c,v 1.1 1992/09/06 19:31:32 mike Exp $"; /* $Log: savestr.c,v $ * Revision 1.1 1992/09/06 19:31:32 mike * Initial revision * */ /* savestr.c: Save a string by malloc()ing space and coping the string. * Returns a pointer to the malloc()ed string. * This is a "black box" copy of a routine in Microsoft C. * C Durland Public Domain */ #include "const.h" char *savestr(str) char *str; /* malloc str and save it */ { char *ptr, *malloc(), *strcpy(); if ((ptr = malloc(strlen(str)+1)) == NULL) return NULL; return strcpy(ptr,str); }