#include "mr_server.h"
#include <ctype.h>
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
fprintf(stderr, "[#%d]", cur_client->id);
fputs(": ", stderr);
}
- if (code)
+ if (code) {
fputs(error_message(code), stderr);
+ fputs(" ", stderr);
+ }
if (fmt)
vfprintf(stderr, fmt, pvar);
putc('\n', stderr);
a[i] = strdup(argv[i]);
return a;
}
+
+
+/* malloc or die! */
+void *xmalloc(size_t bytes)
+{
+ void *buf = malloc(bytes);
+
+ if (buf)
+ return buf;
+
+ critical_alert("moirad", "Out of memory");
+ exit(1);
+}
+
+void *xrealloc(void *ptr, size_t bytes)
+{
+ void *buf = realloc(ptr, bytes);
+
+ if (buf)
+ return buf;
+
+ critical_alert("moirad", "Out of memory");
+ exit(1);
+}