Use replacement library functions to daemonize, rather than #ifdef hell
[tftp-hpa.git] / lib / xstrdup.c
blob5d65b7e0d2bb285920f002f1708e6959dbd3d838
1 /*
2 * xstrdup.c
4 * Simple error-checking version of strdup()
6 */
8 #include <stdlib.h>
9 #include <string.h>
10 #include <stdio.h>
12 char *xstrdup(const char *s)
14 char *p = strdup(s);
16 if ( !p ) {
17 fprintf(stderr, "Out of memory!\n");
18 exit(128);
21 return p;