summaryrefslogtreecommitdiff
path: root/error.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'error.cpp')
-rw-r--r--error.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/error.cpp b/error.cpp
new file mode 100644
index 0000000..e8cf4af
--- /dev/null
+++ b/error.cpp
@@ -0,0 +1,21 @@
+// SVN: $Revision: 56 $
+#include <errno.h>
+#include <stdarg.h>
+#include <string.h>
+#include <vector>
+#include <stdio.h>
+#include <stdlib.h>
+#include <sys/types.h>
+
+void error_exit(const char *format, ...)
+{
+ va_list ap;
+
+ va_start(ap, format);
+ vfprintf(stderr, format, ap);
+ va_end(ap);
+
+ fprintf(stderr, "\nerrno at that time: %s (%d)\n", strerror(errno), errno);
+
+ exit(EXIT_FAILURE);
+}