From 23abb4764a4be094608a14a6637f08e8f3067a76 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 21 Nov 2025 15:49:56 -0500 Subject: Add fatal: prefix to fatal error messages. --- src/extract.c | 10 +++++----- src/io.c | 7 ++++--- src/listalf.c | 3 +-- src/opts.c | 4 ++-- src/unalf.c | 6 +++--- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/extract.c b/src/extract.c index 0fb61f4..b2ee615 100644 --- a/src/extract.c +++ b/src/extract.c @@ -123,8 +123,7 @@ void extract_alf(void) { if(!file_wanted(out_filename)) { if(fseek(in_file, getquad(alf_hdr_compsize0), SEEK_CUR) != 0) { - fputs(self, stderr); - perror(": fseek"); + fprintf(stderr, "%s: fatal: seek failed on input!\n", self); exit(1); } out_filename = 0; @@ -147,6 +146,7 @@ void extract_alf(void) { } if(!(out_file = fopen(out_filename, "wb"))) { + fprintf(stderr, "%s: fatal: ", self); perror(out_filename); exit(1); } @@ -182,16 +182,16 @@ void chksum_err(void) { } void unknown_err(void){ - fprintf(stderr, "%s: unknown error (L7712)\n", self); + fprintf(stderr, "%s: fatal: unknown error (L7712)\n", self); exit(1); } void stack_underrun(void){ - fprintf(stderr, "%s: stack underrun\n", self); + fprintf(stderr, "%s: fatal: stack underrun\n", self); exit(1); } void stack_overrun(void){ - fprintf(stderr, "%s: stack overrun\n", self); + fprintf(stderr, "%s: fatal: stack overrun\n", self); exit(1); } diff --git a/src/io.c b/src/io.c index 9b664d4..4e20505 100644 --- a/src/io.c +++ b/src/io.c @@ -5,12 +5,12 @@ static int headers_read = 0; static int convert_eols = 0; static void die_arc(void) { - fprintf(stderr, "%s: this is an ARC file, not ALF\n", self); + fprintf(stderr, "%s: fatal: this is an ARC file, not ALF\n", self); exit(1); } static void die_not_alf(void) { - fprintf(stderr, "%s: not an ALF file\n", self); + fprintf(stderr, "%s: fatal: not an ALF file\n", self); exit(1); } @@ -143,7 +143,8 @@ void writeblock(void) { bytes = fwrite(buf, 1, len, out_file); if(bytes < 0) { - perror(self); /* TODO: out_filename */ + fprintf(stderr, "%s: fatal: ", self); + perror("write failed"); /* TODO: out_filename */ exit(1); } bytes_written += bytes; diff --git a/src/listalf.c b/src/listalf.c index 2c236c9..8082d11 100644 --- a/src/listalf.c +++ b/src/listalf.c @@ -109,8 +109,7 @@ void list_alf(void) { } if(fseek(in_file, comp_size, SEEK_CUR) != 0) { - fputs(self, stderr); - perror(": fseek"); + fprintf(stderr, "%s: fatal: seek failed on input!\n", self); exit(1); } } diff --git a/src/opts.c b/src/opts.c index 3237642..72f5ce0 100644 --- a/src/opts.c +++ b/src/opts.c @@ -45,13 +45,13 @@ void parse_opts(int argc, char * const *argv) { case 'd': opts.outdir = optarg; break; case 'x': add_exclude(optarg); break; default: - fprintf(stderr, "%s: invalid option (try -h or --help)\n", self); + fprintf(stderr, "%s: fatal: invalid option (try -h or --help)\n", self); exit(1); } } if(optind >= argc) { - fprintf(stderr, "%s: missing alf file argument (try -h or --help)\n", self); + fprintf(stderr, "%s: fatal: missing alf file argument (try -h or --help)\n", self); exit(1); } diff --git a/src/unalf.c b/src/unalf.c index ee235b1..9a43bb2 100644 --- a/src/unalf.c +++ b/src/unalf.c @@ -21,13 +21,13 @@ static void create_outdir(void) { mkdir(opts.outdir, 0777); #endif if(r < 0 && errno != EEXIST) { - fprintf(stderr, "%s: ", self); + fprintf(stderr, "%s: fatal: ", self); perror(opts.outdir); exit(1); } if(chdir(opts.outdir) < 0) { - fprintf(stderr, "%s: ", self); + fprintf(stderr, "%s: fatal: ", self); perror(opts.outdir); exit(1); } @@ -61,7 +61,7 @@ int main(int argc, char **argv) { parse_opts(argc, argv); if(!(in_file = fopen(in_filename, "rb"))) { - fprintf(stderr, "%s: ", self); + fprintf(stderr, "%s: fatal: ", self); perror(in_filename); exit(1); } -- cgit v1.2.3