summaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/debug.h11
-rw-r--r--src/util/error.c9
-rw-r--r--src/util/error.h5
-rw-r--r--src/util/versie.c7
-rw-r--r--src/util/versie.h6
5 files changed, 38 insertions, 0 deletions
diff --git a/src/util/debug.h b/src/util/debug.h
new file mode 100644
index 0000000..9ee7c5f
--- /dev/null
+++ b/src/util/debug.h
@@ -0,0 +1,11 @@
+#pragma once
+
+
+// Uncomment this to enable DEBUG() statements.
+// #define ENABLE_DEBUG
+
+#ifdef ENABLE_DEBUG
+#define DEBUG(...) fprintf(stderr, ">> " __VA_ARGS__)
+#else
+#define DEBUG(...)
+#endif
diff --git a/src/util/error.c b/src/util/error.c
new file mode 100644
index 0000000..e7f1f02
--- /dev/null
+++ b/src/util/error.c
@@ -0,0 +1,9 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include "error.h"
+
+
+void print_error_nomem(const char *progname) {
+ fprintf(stderr, "%s: Kon geen geheugen reserveren!\n", progname);
+ exit(1);
+}
diff --git a/src/util/error.h b/src/util/error.h
new file mode 100644
index 0000000..99a9c77
--- /dev/null
+++ b/src/util/error.h
@@ -0,0 +1,5 @@
+#pragma once
+
+
+__attribute__((noreturn))
+void print_error_nomem(const char *progname);
diff --git a/src/util/versie.c b/src/util/versie.c
new file mode 100644
index 0000000..880823a
--- /dev/null
+++ b/src/util/versie.c
@@ -0,0 +1,7 @@
+#include "versie.h"
+
+void drukkedoos_print_versie(FILE *f, const char *progname) {
+ fprintf(f,
+ "%s, deel van drukkedoos versie %s\n",
+ progname, DRUKKEDOOS_VERSIE);
+}
diff --git a/src/util/versie.h b/src/util/versie.h
new file mode 100644
index 0000000..0f1dafb
--- /dev/null
+++ b/src/util/versie.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include <stdio.h>
+
+
+void drukkedoos_print_versie(FILE *f, const char *progname);