+
+void
+crash_out (char *why)
+{
+ terminal_atexit ();
+ fprintf (stderr, "sympathy is aborting: %s\n", why ? why : "");
+ exit (1);
+}
+
+void *
+xmalloc (size_t s)
+{
+ void *ret = malloc (s);
+ if (!ret)
+ crash_out ("malloc failed");
+ return ret;
+}
+
+void *
+xrealloc (void *p, size_t s)
+{
+ p = realloc (p, s);
+ if (!p)
+ crash_out ("realloc failed");
+ return p;
+}
+
+char *
+xstrdup (const char *s)
+{
+ char *ret = strdup (s);
+ if (!ret)
+ crash_out ("strdup failed");
+ return ret;
+}