aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-05 16:29:37 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-05 16:29:37 -0400
commit15cedfcccd950b76673d59eb48f674b50330ac0d (patch)
tree161fd2c1c5399847daad910cce5ddb250d7e9800
parentb0eec4c320253238aa528d3899fc70a7eab91379 (diff)
downloadbw-atari8-tools-15cedfcccd950b76673d59eb48f674b50330ac0d.tar.gz
listbas: exit with status 2 on invaid tokens, add note to doc about aha.
-rw-r--r--listbas.119
-rw-r--r--listbas.c6
-rw-r--r--listbas.rst11
3 files changed, 32 insertions, 4 deletions
diff --git a/listbas.1 b/listbas.1
index 13d53f4..6170b6a 100644
--- a/listbas.1
+++ b/listbas.1
@@ -145,9 +145,26 @@ specifically asked to do so.
\fBlistbas\fP tells you if the program is protected, and refuses to operate
on variable\-protected programs.
.UNINDENT
+.sp
+I thought about adding an HTML output option, but there\(aqs no need: if you want
+a colorful listing of an Atari BASIC program, install \fBaha\fP(1) from
+\fI\%https://github.com/theZiz/aha\fP (or your distro\(aqs package repo) and run
+something like:
+.INDENT 0.0
+.INDENT 3.5
+.sp
+.nf
+.ft C
+listbas PROGRAM.BAS | aha > program.html
+.ft P
+.fi
+.UNINDENT
+.UNINDENT
.SH EXIT STATUS
.sp
-0 for success, 1 for failure.
+0 for success, 1 if there was an error reading the input (e.g. file
+not found), or 2 if the input file has invalid tokens (if this
+happens, you will also see a warning about it on stderr).
.SH COPYRIGHT
.sp
WTFPL. See \fI\%http://www.wtfpl.net/txt/copying/\fP for details.
diff --git a/listbas.c b/listbas.c
index fd7d8aa..ef3f031 100644
--- a/listbas.c
+++ b/listbas.c
@@ -321,8 +321,10 @@ int main(int argc, char **argv) {
setup_outfh();
list();
- if(badtok)
- die("program has unknown tokens; maybe Turbo BASIC or BASIC XL/XE?");
+ if(badtok) {
+ fprintf(stderr, "%s: program has unknown tokens; maybe Turbo BASIC or BASIC XL?", self);
+ return 2;
+ }
return 0;
}
diff --git a/listbas.rst b/listbas.rst
index 6fda1cb..881da5f 100644
--- a/listbas.rst
+++ b/listbas.rst
@@ -118,9 +118,18 @@ protection.
- **listbas** tells you if the program is protected, and refuses to operate
on variable-protected programs.
+I thought about adding an HTML output option, but there's no need: if you want
+a colorful listing of an Atari BASIC program, install **aha**\(1) from
+https://github.com/theZiz/aha (or your distro's package repo) and run
+something like::
+
+ listbas PROGRAM.BAS | aha > program.html
+
EXIT STATUS
===========
-0 for success, 1 for failure.
+0 for success, 1 if there was an error reading the input (e.g. file
+not found), or 2 if the input file has invalid tokens (if this
+happens, you will also see a warning about it on stderr).
.. include:: manftr.rst