diff options
| author | B. Watson <urchlay@slackware.uk> | 2024-07-05 04:28:40 -0400 | 
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2024-07-05 04:28:40 -0400 | 
| commit | b0eec4c320253238aa528d3899fc70a7eab91379 (patch) | |
| tree | 94b3d0e1fc52ee82bcf3757822abc92cf85724d5 | |
| parent | 2874cc34e718b2129f8982a3d512219d893a0308 (diff) | |
| download | bw-atari8-tools-b0eec4c320253238aa528d3899fc70a7eab91379.tar.gz | |
listbas: error exit on bad tokens.
| -rw-r--r-- | listbas.1 | 12 | ||||
| -rw-r--r-- | listbas.c | 18 | 
2 files changed, 19 insertions, 11 deletions
| @@ -45,6 +45,10 @@ escape sequences for inverse video and color syntax highlighting.  .SS List options  .INDENT 0.0  .TP +.B \fB\-a\fP +Output raw ATASCII; no translation to the host character set. Must be +used with redirection; \fBlistbas\fP will not write ATASCII to the terminal. +.TP  .B \fB\-b\fP  Use bold, for color output. This may make it easier to read on  some terminals. Or, it may hurt your eyes... @@ -52,16 +56,12 @@ some terminals. Or, it may hurt your eyes...  .B \fB\-i\fP  Include the immediate mode command (line 32768) in the output.  .TP -.B \fB\-a\fP -Output raw ATASCII; no translation to the host character set. Must be -used with redirection; \fBlistbas\fP will not write ATASCII to the terminal. +.B \fB\-m\fP +Output "magazine listing". See the \fB\-m\fP option for \fBa8cat\fP for details.  .TP  .B \fB\-n\fP  No color. Has no effect if \fB\-a\fP or \fB\-m\fP are in effect, since these  modes don\(aqt support color anyway. -.TP -.B \fB\-m\fP -Output "magazine listing". See the \fB\-m\fP option for \fBa8cat\fP for details.  .UNINDENT  .SS General Options  .INDENT 0.0 @@ -19,7 +19,8 @@  #define C_PURPLE  5  #define C_CYAN    6 -int immediate = 0, utf8 = 1, magazine = 0, inv = 0, color = 1, bold = 0; +int immediate = 0, utf8 = 1, magazine = 0, inv = 0, +	 color = 1, bold = 0, badtok = 0;  const char **table = ata2utf; @@ -200,10 +201,12 @@ CALLBACK(print_cmd) {  	if(tok == CMD_ILET) return;  	if(color) color_on(C_YELLOW); -	if(tok > last_command || (!(name = commands[tok]))) +	if(tok > last_command || (!(name = commands[tok]))) {  		fprintf(outfh, "(bad cmd token $%02x) ", tok); -	else +		badtok = 1; +	} else {  		fprintf(outfh, "%s ", name); +	}  	if(color) color_off();  } @@ -232,10 +235,12 @@ CALLBACK(print_op) {  		else  			color_on(C_GREEN);  	} -	if(tok > last_operator || (!(name = operators[tok]))) +	if(tok > last_operator || (!(name = operators[tok]))) {  		fprintf(outfh, "(bad op token $%02x)", tok); -	else +		badtok = 1; +	} else {  		fprintf(outfh, "%s", name); +	}  	if(color) color_off();  } @@ -316,5 +321,8 @@ int main(int argc, char **argv) {  	setup_outfh();  	list(); +	if(badtok) +		die("program has unknown tokens; maybe Turbo BASIC or BASIC XL/XE?"); +  	return 0;  } | 
