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: }

Defined functions

Last modified: 1985-07-03
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 920
Valid CSS Valid XHTML 1.0 Strict