diff options
Diffstat (limited to 'enstrdup.c')
-rw-r--r-- | enstrdup.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/enstrdup.c b/enstrdup.c new file mode 100644 index 0000000..da008ce --- /dev/null +++ b/enstrdup.c @@ -0,0 +1,17 @@ +/* See LICENSE file for copyright and license details. */ +#include "libsimple.h" + + +extern char *argv0; + + +char * +enstrdup(int status, const char *s) +{ + char *ret = strdup(s); + if (!ret) { + fprintf(stderr, "%s: strdup: %s\n", argv0, strerror(errno)); + exit(status); + } + return ret; +} |