diff options
author | B. Watson <urchlay@slackware.uk> | 2024-05-31 01:59:23 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-05-31 02:01:41 -0400 |
commit | 8bb878d21591d08ed7a763825fa03abeed384c57 (patch) | |
tree | cd9f10cd0ec9114808470e2dfc75d3e2abac4d61 | |
parent | 4fed70d72e1c085057fb2c9f92acc806306ca560 (diff) | |
download | bw-atari8-tools-8bb878d21591d08ed7a763825fa03abeed384c57.tar.gz |
unprotbas: stop allowing 3 filenames.
-rw-r--r-- | unprotbas.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/unprotbas.c b/unprotbas.c index 05a5f6e..c1c0e68 100644 --- a/unprotbas.c +++ b/unprotbas.c @@ -811,9 +811,10 @@ void parse_args(int argc, char **argv) { default: invalid_args(*argv); break; } } else { + /* arg doesn't start with a -, must be a filename */ if(!input_file) open_input(*argv); - else if(!checkonly && !output_file) + else if(!checkonly && !output_filename) output_filename = *argv; else invalid_args(*argv); @@ -890,6 +891,8 @@ int main(int argc, char **argv) { } } + /* we don't open the output file until all processing is done, to + avoid leaving invalid output files if we exit on error. */ open_output(output_filename); outbytes = fwrite(data, 1, filelen, output_file); fclose(output_file); |