+#include <sys/wait.h>
+#include <unistd.h>
+
+/* static */
+
+static void
+bad_malloc(unsigned int size)
+{
+ fprintf(stderr, "fatal: could not malloc() %d bytes\n",
+ (int) size);
+ exit(EXIT_FAILURE);
+}
+
+/* extern */
+
+void *
+emallocz(unsigned int size)
+{
+ void *res = calloc(1, size);
+ if(!res)
+ bad_malloc(size);
+ return res;
+}