diff options
author | B. Watson <urchlay@slackware.uk> | 2024-04-25 02:02:07 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-04-25 02:02:07 -0400 |
commit | c46d2c157f14121c3f844f5f438eefa559b2b92f (patch) | |
tree | 6e82898a791d4f839139a378afca89ef52c1ce21 /blob2xex.c | |
parent | 0ea27c84381a934f07c8f367fdaf6949a9376e79 (diff) | |
download | bw-atari8-tools-c46d2c157f14121c3f844f5f438eefa559b2b92f.tar.gz |
blob2xex: put "fatal:" in error messages.
Diffstat (limited to 'blob2xex.c')
-rw-r--r-- | blob2xex.c | 16 |
1 files changed, 9 insertions, 7 deletions
@@ -46,12 +46,13 @@ int write_segment( int c; if(size < 1) { - fprintf(stderr, SELF ": invalid size %d (must be >= 1).\n", size); + fprintf(stderr, SELF ": fatal: invalid size %d (must be >= 1).\n", size); return(0); } if(strcmp(infile, "-") == 0) { infh = stdin; + infile = "(standard input)"; } else { infh = fopen(infile, "rb"); if(!infh) { @@ -69,7 +70,7 @@ int write_segment( } else { outfh = fopen(outfile, "wb"); if(!outfh) { - fprintf(stderr, SELF ": %s: %s\n", outfile, strerror(errno)); + fprintf(stderr, SELF ": fatal: %s: %s\n", outfile, strerror(errno)); return(0); } } @@ -77,7 +78,7 @@ int write_segment( if(isatty(fileno(outfh))) { fprintf(stderr, - SELF ": Standard output is a terminal; not writing binary data\n"); + SELF ": fatal: standard output is a terminal; not writing binary data.\n"); return 0; } @@ -85,12 +86,13 @@ int write_segment( seg.len = 0; seg.start_addr = loadaddr; - /* skip <offset> bytes in input. don't seek, input might be stdin */ + /* skip <offset> bytes in input. don't seek, input might be stdin. + not very efficient to read 1 byte at a time, but we're dealing + with very small files, by modern standards. */ while(offset) { - /* TODO: not very efficient to read 1 byte at a time? */ c = getc(infh); if(c < 0) { - fprintf(stderr, SELF ": offset extends past EOF on file %s\n", infile); + fprintf(stderr, SELF ": fatal: offset extends past EOF on file %s\n", infile); return(0); } offset--; @@ -110,7 +112,7 @@ int write_segment( } if(seg.len == 0) { - fprintf(stderr, SELF ": read 0 bytes from %s, xex files cannot contain empty segments.\n", infile); + fprintf(stderr, SELF ": fatal: read 0 bytes from %s, xex files cannot contain empty segments.\n", infile); return(0); } |