summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aardig.c2
-rw-r--r--src/hoofd.c2
-rw-r--r--src/io/lines.c4
-rw-r--r--src/io/read_file.c5
-rw-r--r--src/ja.c2
-rw-r--r--src/kat.c2
-rw-r--r--src/omd.c2
-rw-r--r--src/rij.c2
-rw-r--r--src/spons.c2
-rw-r--r--src/tak.c2
-rw-r--r--src/toilet.c2
-rw-r--r--src/util/error.c3
-rw-r--r--src/util/error.h2
-rw-r--r--src/util/option.c2
-rw-r--r--src/util/versie.c3
-rw-r--r--src/util/versie.h2
-rw-r--r--src/wiebenik.c2
17 files changed, 22 insertions, 19 deletions
diff --git a/src/aardig.c b/src/aardig.c
index 0388782..2203ac1 100644
--- a/src/aardig.c
+++ b/src/aardig.c
@@ -37,7 +37,7 @@ static char** parse_options(int argc, char **argv, int *niceness) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "aardig");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/hoofd.c b/src/hoofd.c
index 9e428e9..f043f2b 100644
--- a/src/hoofd.c
+++ b/src/hoofd.c
@@ -40,7 +40,7 @@ static char** parse_options(int argc, char **argv, int *n, int *c) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "hoofd");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/io/lines.c b/src/io/lines.c
index fd9c3a5..e5de6df 100644
--- a/src/io/lines.c
+++ b/src/io/lines.c
@@ -12,7 +12,7 @@ bool file_lines_open(const char *progname, const char *fname, FILE *f, struct fi
dst->cap = 4096;
dst->buffer = malloc(dst->cap);
if (!dst->buffer) {
- print_error_nomem(progname);
+ print_error_nomem();
return false;
}
@@ -56,7 +56,7 @@ bool file_lines_read(struct file_lines *fl, struct string_view *dst) {
}
DEBUG("realloc to cap %zu\n", fl->cap);
fl->buffer = realloc(fl->buffer, fl->cap);
- if (!fl->buffer) print_error_nomem(fl->progname);
+ if (!fl->buffer) print_error_nomem();
}
size_t nr = fread(fl->buffer + fl->cursor, 1, fl->cap - fl->cursor, fl->f);
diff --git a/src/io/read_file.c b/src/io/read_file.c
index 2ff00a5..99bea2a 100644
--- a/src/io/read_file.c
+++ b/src/io/read_file.c
@@ -5,10 +5,11 @@
#include <unistd.h>
#include "read_file.h"
+#include "global.h"
#define CHECK_OOM(ptr) \
if (ptr == NULL) { \
- fprintf(stderr, "geheugen is op\n"); \
+ fprintf(stderr, "%s: geheugen is op\n", progname); \
/* I think I should free the original memory here, but whatever */ \
return NULL; \
}
@@ -35,7 +36,7 @@ struct filebuf *stream_to_filebuf(FILE *restrict stream, int openOptions) {
sz += n;
if (n != amount && !feof(stream)) {
- fprintf(stderr, "fout tijdens lezen van standaard invoer.\n");
+ fprintf(stderr, "%s: fout tijdens lezen van standaard invoer.\n", progname);
free(buf);
return NULL;
}
diff --git a/src/ja.c b/src/ja.c
index 3d6135d..bfb69ed 100644
--- a/src/ja.c
+++ b/src/ja.c
@@ -26,7 +26,7 @@ static char** parse_options(int argc, char **argv) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "ja");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/kat.c b/src/kat.c
index 0a17ddc..6ca8d28 100644
--- a/src/kat.c
+++ b/src/kat.c
@@ -26,7 +26,7 @@ static char** parse_options(int argc, char **argv) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "kat");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/omd.c b/src/omd.c
index 71b8dee..2658687 100644
--- a/src/omd.c
+++ b/src/omd.c
@@ -25,7 +25,7 @@ static char** parse_options(int argc, char **argv) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "omd");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/rij.c b/src/rij.c
index 1ea1b35..1803cdd 100644
--- a/src/rij.c
+++ b/src/rij.c
@@ -26,7 +26,7 @@ static char** parse_options(int argc, char **argv) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "rij");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/spons.c b/src/spons.c
index 51bb109..397d9e5 100644
--- a/src/spons.c
+++ b/src/spons.c
@@ -32,7 +32,7 @@ static char** parse_options(int argc, char **argv, bool *a) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "spons");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/tak.c b/src/tak.c
index 245a85c..8ae6ca5 100644
--- a/src/tak.c
+++ b/src/tak.c
@@ -27,7 +27,7 @@ static char** parse_options(int argc, char **argv) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "tak");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/toilet.c b/src/toilet.c
index aa4fbfa..10c7510 100644
--- a/src/toilet.c
+++ b/src/toilet.c
@@ -54,7 +54,7 @@ static char** parse_options(int argc, char **argv, int *modeMap) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "toilet");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':
diff --git a/src/util/error.c b/src/util/error.c
index e7f1f02..6c02810 100644
--- a/src/util/error.c
+++ b/src/util/error.c
@@ -2,8 +2,9 @@
#include <stdlib.h>
#include "error.h"
+#include "global.h"
-void print_error_nomem(const char *progname) {
+void print_error_nomem() {
fprintf(stderr, "%s: Kon geen geheugen reserveren!\n", progname);
exit(1);
}
diff --git a/src/util/error.h b/src/util/error.h
index 99a9c77..27f9ea8 100644
--- a/src/util/error.h
+++ b/src/util/error.h
@@ -2,4 +2,4 @@
__attribute__((noreturn))
-void print_error_nomem(const char *progname);
+void print_error_nomem();
diff --git a/src/util/option.c b/src/util/option.c
index ef7a398..5efcbd7 100644
--- a/src/util/option.c
+++ b/src/util/option.c
@@ -65,7 +65,7 @@ char** option_parse(int argc, char **argv, const struct option_spec *speclist) {
exit(0);
case OPTSPECKIND_VERSION:
- drukkedoos_print_versie(stdout, argv[0]);
+ drukkedoos_print_versie(stdout);
exit(0);
case OPTSPECKIND_END: abort(); // unreachable
diff --git a/src/util/versie.c b/src/util/versie.c
index 880823a..cdb7341 100644
--- a/src/util/versie.c
+++ b/src/util/versie.c
@@ -1,6 +1,7 @@
#include "versie.h"
+#include "global.h"
-void drukkedoos_print_versie(FILE *f, const char *progname) {
+void drukkedoos_print_versie(FILE *f) {
fprintf(f,
"%s, deel van drukkedoos versie %s\n",
progname, DRUKKEDOOS_VERSIE);
diff --git a/src/util/versie.h b/src/util/versie.h
index 0f1dafb..f24b359 100644
--- a/src/util/versie.h
+++ b/src/util/versie.h
@@ -3,4 +3,4 @@
#include <stdio.h>
-void drukkedoos_print_versie(FILE *f, const char *progname);
+void drukkedoos_print_versie(FILE *f);
diff --git a/src/wiebenik.c b/src/wiebenik.c
index 5d71ef4..8515701 100644
--- a/src/wiebenik.c
+++ b/src/wiebenik.c
@@ -27,7 +27,7 @@ static char** parse_options(int argc, char **argv) {
exit(0);
case 'V':
- drukkedoos_print_versie(stdout, "wiebenik");
+ drukkedoos_print_versie(stdout);
exit(0);
case '?':