Category : C Source Code
Archive   : CSRC2.ZIP
Filename : SAVEST.C

Output of file : SAVEST.C contained in archive : CSRC2.ZIP
* s a v e s t . c



title savestr Make a Safe Copy of a String
index Make a safe copy of a string


char *
char s[];


savestr(s) returns a pointer to a newly-allocated block of memory
containing a copy of s. The memory is obtained from malloc() and
should be freed with free() when you are done with it.

savestr() returns NULL if it cannot obtain the memory it needs.



Jerry Leichter


* Edit history
* 0.0 19-May-81 JSL Invention
* 0.1 09-Dec-81 MM Changed cpystr() to strcpy()

#define NULL 0

extern char *malloc();

char *
register char s[];
{ register char *new;
if ((new=malloc(strlen(s)+1)) != NULL)

  3 Responses to “Category : C Source Code
Archive   : CSRC2.ZIP
Filename : SAVEST.C

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: