From ec5d94be4d5bf775599f67875e07da869b9c1834 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Tue, 25 Jun 2024 19:58:44 -0400 Subject: listbas: exit cleanly if code is protected. --- listbas.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'listbas.c') 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(); -- cgit v1.2.3