Add replacement library files

This commit is contained in:
hpa 2001-03-30 01:02:55 +00:00
parent e6593dd693
commit d0fec7a322
4 changed files with 87 additions and 0 deletions

22
lib/xstrdup.c Normal file
View file

@ -0,0 +1,22 @@
/*
* xstrdup.c
*
* Simple error-checking version of strdup()
*
*/
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
char *xstrdup(const char *s)
{
char *p = strdup(s);
if ( !p ) {
fprintf(stderr, "Out of memory!\n");
exit(128);
}
return p;
}