|
|
1.1 ! root 1: /* $Header: strsav.c,v 1.1 85/03/14 17:00:30 nicklin Exp $ */ ! 2: ! 3: /* ! 4: * Author: Peter J. Nicklin ! 5: */ ! 6: ! 7: /* ! 8: * strsav() saves a string somewhere and returns a pointer to the somewhere. ! 9: * Returns NULL on error. ! 10: */ ! 11: #include "null.h" ! 12: ! 13: char * ! 14: strsav(s) ! 15: char *s; ! 16: { ! 17: char *sptr; /* somewhere string pointer */ ! 18: char *malloc(); /* memory allocator */ ! 19: char *strcpy(); /* string copy */ ! 20: int strlen(); /* string length */ ! 21: ! 22: if ((sptr = malloc((unsigned)(strlen(s)+1))) == NULL) ! 23: return(NULL); ! 24: return(strcpy(sptr, s)); ! 25: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.