Program name in error messages

This commit is contained in:
Matteo Bini 2024-07-15 10:40:34 +02:00
parent fb1c2b971e
commit f005138672
2 changed files with 5 additions and 5 deletions

View File

@ -3,7 +3,7 @@ VERSION = 0.1
PREFIX = /usr/local
CPPFLAGS_SROHTML = -DVERSION=\"${VERSION}\" ${CPPFLAGS}
CPPFLAGS_SROHTML = -DBIN=\"${BIN}\" -DVERSION=\"${VERSION}\" ${CPPFLAGS}
# debug
#CFLAGS_SROHTML = -ggdb -ansi -pedantic ${CPPFLAGS_SROHTML} ${CLAGS}
CFLAGS_SROHTML = -Os -ansi -pedantic ${CPPFLAGS_SROHTML} ${CFLAGS}

View File

@ -602,7 +602,7 @@ main (int argc, char *argv[])
in = fopen(argv[1], "r");
if (in == NULL) {
fprintf(stderr, "Can't open %s.\n", argv[1]);
fprintf(stderr, BIN ": Can't open %s.\n", argv[1]);
return 1;
}
@ -660,7 +660,7 @@ main (int argc, char *argv[])
else
out = fopen(argv[2], "w");
if (out == NULL) {
fprintf(stderr, "Can't open %s.\n", argv[2]);
fprintf(stderr, BIN ": Can't open %s.\n", argv[2]);
return 1;
}
@ -788,7 +788,7 @@ safe_malloc(const size_t size)
ptr = malloc(size);
if (ptr == NULL) {
fprintf(stderr, "Can't allocate %lu bytes.\n", size);
fprintf(stderr, BIN ": Can't allocate %lu bytes.\n", size);
exit(1);
}
@ -802,7 +802,7 @@ safe_realloc(void *ptr, const size_t size)
new = realloc(ptr, size);
if (new == NULL) {
fprintf(stderr, "Can't allocate %lu bytes.\n", size);
fprintf(stderr, BIN ": Can't allocate %lu bytes.\n", size);
exit(1);
}