aboutsummaryrefslogtreecommitdiff
path: root/blob2xex.c
diff options
context:
space:
mode:
Diffstat (limited to 'blob2xex.c')
-rw-r--r--blob2xex.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/blob2xex.c b/blob2xex.c
index 2ff7249..ed2b60a 100644
--- a/blob2xex.c
+++ b/blob2xex.c
@@ -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);
}