aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-06-25 19:58:44 -0400
committerB. Watson <urchlay@slackware.uk>2024-06-25 19:58:44 -0400
commitec5d94be4d5bf775599f67875e07da869b9c1834 (patch)
treeba57825ab6c5b4d5fe1299a7b397a2d4ca555dda
parent78b7b515b2140d92d635e9f59d701877bebe8b11 (diff)
downloadbw-atari8-tools-ec5d94be4d5bf775599f67875e07da869b9c1834.tar.gz
listbas: exit cleanly if code is protected.
-rw-r--r--listbas.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/listbas.c b/listbas.c
index 86bb3f7..bc56695 100644
--- a/listbas.c
+++ b/listbas.c
@@ -196,6 +196,12 @@ void close_outfh(void) {
}
}
+CALLBACK(code_prot) {
+ fprintf(stderr, "%s: Program is code-protected, stopping at line %d.\n", self, lineno);
+ close_outfh();
+ exit(0);
+}
+
void list(void) {
on_start_line = print_lineno;
on_cmd_token = print_cmd;
@@ -203,6 +209,7 @@ void list(void) {
on_var_token = print_varname;
on_end_line = print_newline;
on_text = print_text;
+ on_bad_line_length = code_prot;
walk_code(0, 32767 + immediate);
}
@@ -214,6 +221,9 @@ int main(int argc, char **argv) {
readfile();
parse_header();
+ if(!vntable_ok())
+ die("Program is variable-protected; unprotect it first.");
+
setup_outfh();
list();
close_outfh();