From 15cedfcccd950b76673d59eb48f674b50330ac0d Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 5 Jul 2024 16:29:37 -0400 Subject: listbas: exit with status 2 on invaid tokens, add note to doc about aha. --- listbas.1 | 19 ++++++++++++++++++- listbas.c | 6 ++++-- listbas.rst | 11 ++++++++++- 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 -- cgit v1.2.3