/*
 * strsave - like strdup, but error if can't allocate
 */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

/*
 * Copy "s" into malloced memory, if any is available, and
 * return the address of the malloced memory.
 * If not, return NULL.
 */
char *
strsave(s)
register char *s;
{
	register char *news = malloc((unsigned)strlen(s) + 1);

	if (news != NULL)
		(void) strcpy(news, s);
	return news;
}
