aboutsummaryrefslogtreecommitdiff
path: root/unprotbas.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-05-24 14:54:23 -0400
committerB. Watson <urchlay@slackware.uk>2024-05-24 14:54:23 -0400
commita095768910dde7a8581aa018eceef5f2f899d1fa (patch)
treeb0f48bd796817d06c8358fb5dd6762ad4c0c36f7 /unprotbas.c
parent59de645bcbc02f4044a697bbcc3a2a2a8523975f (diff)
downloadbw-atari8-tools-a095768910dde7a8581aa018eceef5f2f899d1fa.tar.gz
unprotbas: fix exit status.
Diffstat (limited to 'unprotbas.c')
-rw-r--r--unprotbas.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/unprotbas.c b/unprotbas.c
index 686b8c3..cfdcf75 100644
--- a/unprotbas.c
+++ b/unprotbas.c
@@ -231,8 +231,10 @@ void breakcode(void) {
break;
} else {
offset = data[pos + 2];
- if(!offset)
- die("program already was code-protected");
+ if(!offset) {
+ fprintf(stderr, "%s: program already was code-protected.\n", self);
+ exit(2);
+ }
oldpos = pos;
pos += offset;
}
@@ -732,6 +734,7 @@ int main(int argc, char **argv) {
}
if(protect_vars) scramble_vars();
if(protect_code) breakcode();
+ was_protected = 1; /* opposite sense for this one */
} else {
if(readmap) {
was_protected = !vntable_ok();
@@ -764,10 +767,7 @@ int main(int argc, char **argv) {
if(checkonly) {
if(verbose) fprintf(stderr, "Check-only mode; no output written.\n");
- if(was_protected)
- return 0;
- else
- return 2;
+ return was_protected ? 0 : 2;
}
}
@@ -777,5 +777,5 @@ int main(int argc, char **argv) {
if(writemap) write_var_map();
- return 0;
+ return was_protected ? 0 : 2;
}