aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--listbas.127
-rw-r--r--listbas.c23
-rw-r--r--listbas.rst25
3 files changed, 39 insertions, 36 deletions
diff --git a/listbas.1 b/listbas.1
index a22e490..dce7340 100644
--- a/listbas.1
+++ b/listbas.1
@@ -27,25 +27,24 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]
.\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]
.in \\n[rst2man-indent\\n[rst2man-indent-level]]u
..
-.TH "LISTBAS" 1 "2024-06-26" "0.2.1" "Urchlay's Atari 8-bit Tools"
+.TH "LISTBAS" 1 "2024-07-01" "0.2.1" "Urchlay's Atari 8-bit Tools"
.SH NAME
listbas \- List the source of a tokenized Atari 8-bit BASIC program
.SH SYNOPSIS
.sp
-listbas [\fB\-v\fP] [\fB\-i\fP] [\fB\-a\fP | \fB\-u\fP ] \fBinput\-file\fP
+listbas [\fB\-v\fP] [\fB\-i\fP] [\fB\-a\fP | \fB\-m\fP ] \fBinput\-file\fP
.SH DESCRIPTION
.sp
\fBlistbas\fP acts like the \fILIST\fP command in BASIC. It reads a
tokenized (SAVEd) BASIC program and prints the code in human\-readable
format.
.sp
-By default, output is piped through \fBa8eol\fP(1), to convert ATASCII
-characters to human\-readable sequences. Raw ATASCII and Unicode output
-are also available.
+By default, output is piped through \fBa8cat\fP(1), to covert ATASCII
+characters into Unicode equivalents. Raw ATASCII and "magazine listing"
+mode are also available.
.sp
-\fBa8eol\fP(1) and \fBa8utf8\fP(1) (for \fB\-u\fP) are run as external
-processes. The executables are searched for first in the current
-directory, and then in \fIPATH\fP\&.
+\fBa8cat\fP is run as an external processe. The executables is searched
+for first in the current directory, and then in \fIPATH\fP\&.
.SH OPTIONS
.SS List options
.INDENT 0.0
@@ -57,8 +56,9 @@ Include the immediate mode command (line 32768) in the output.
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\-u\fP
-Use \fBa8utf8\fP(1) to translate ATASCII to ASCII.
+.B \fB\-m\fP
+Output "magazine listing". Pipes output through \fBa8cat \-m\fP; see the man
+page for \fBa8cat\fP for details.
.UNINDENT
.SS General Options
.INDENT 0.0
@@ -88,9 +88,10 @@ protection.
\fBlistbas\fP doesn\(aqt show information about the variables. Use \fBvxrefbas\fP(1)
for that.
.IP \(bu 2
-\fBlistbas\fP will not write ATASCII data to your terminal. Instead, it uses
-\fBa8eol\fP(1) or \fBa8utf8\fP(1) to convert the output to something human\-readable
-that won\(aqt confuse the terminal.
+\fBlistbas\fP will not write ATASCII data to your terminal. By default, it uses
+\fBa8cat\fP(1) to convert the output to something human\-readable
+that won\(aqt confuse the terminal. When outputting raw ATASCII (\fB\-a\fP option),
+it refuses to run if standard output is a terminal.
.IP \(bu 2
\fBlistbas\fP only lists line 32768 (the immediate mode command) if
specifically asked to do so.
diff --git a/listbas.c b/listbas.c
index a278bd7..329ff97 100644
--- a/listbas.c
+++ b/listbas.c
@@ -12,7 +12,7 @@
#include "bcdfp.h"
#include "tokens.h"
-int immediate = 0, a8utf8 = 0, a8eol = 1;
+int immediate = 0, a8cat = 1, magazine = 0;
FILE *outfh;
@@ -21,18 +21,18 @@ void print_help(void) {
printf(" -v: verbose.\n");
printf(" -i: show immediate mode command (line 32768).\n");
printf(" -a: output raw ATASCII.\n");
- printf(" -u: output Unicode.\n");
+ printf(" -m: magazine style listing (see a8cat(1)).\n");
}
void parse_args(int argc, char **argv) {
int opt;
- while( (opt = getopt(argc, argv, "viau")) != -1) {
+ while( (opt = getopt(argc, argv, "viam")) != -1) {
switch(opt) {
case 'v': verbose = 1; break;
case 'i': immediate = 1; break;
- case 'a': a8utf8 = a8eol = 0; break;
- case 'u': a8utf8 = 1; a8eol = 0; break;
+ case 'a': a8cat = magazine = 0; break;
+ case 'm': a8cat = magazine = 1; break;
default:
print_help();
exit(1);
@@ -50,10 +50,11 @@ void setup_outfh(void) {
/* search current dir before PATH. no easy way to detect errors here,
have to wait until we call pclose(). */
- if(a8eol) {
- cmd = "./a8eol -u -c 2>/dev/null || a8eol -u -c 2>/dev/null || exit 1";
- } else if(a8utf8) {
- cmd = "./a8utf8 2>/dev/null || a8utf8 2>/dev/null || exit 1";
+ if(a8cat) {
+ if(magazine)
+ cmd = "./a8cat -m 2>/dev/null || a8cat -m 2>/dev/null || exit 1";
+ else
+ cmd = "./a8cat 2>/dev/null || a8cat 2>/dev/null || exit 1";
} else {
if(isatty(fileno(stdout))) {
die("Refusing to write ATASCII data to the terminal.");
@@ -72,9 +73,9 @@ void setup_outfh(void) {
}
void close_outfh(void) {
- if(a8eol || a8utf8) {
+ if(a8cat) {
if(pclose(outfh)) {
- die("output filter failed; a8eol or a8utf8 not in current dir or $PATH.");
+ die("output filter failed; a8cat not in current dir or $PATH.");
}
}
}
diff --git a/listbas.rst b/listbas.rst
index c4a937a..d6d17b1 100644
--- a/listbas.rst
+++ b/listbas.rst
@@ -11,7 +11,7 @@ List the source of a tokenized Atari 8-bit BASIC program
SYNOPSIS
========
-listbas [**-v**] [**-i**] [**-a** | **-u** ] **input-file**
+listbas [**-v**] [**-i**] [**-a** | **-m** ] **input-file**
DESCRIPTION
===========
@@ -20,13 +20,12 @@ DESCRIPTION
tokenized (SAVEd) BASIC program and prints the code in human-readable
format.
-By default, output is piped through **a8eol**\(1), to convert ATASCII
-characters to human-readable sequences. Raw ATASCII and Unicode output
-are also available.
+By default, output is piped through **a8cat**\(1), to covert ATASCII
+characters into Unicode equivalents. Raw ATASCII and "magazine listing"
+mode are also available.
-**a8eol**\(1) and **a8utf8**\(1) (for **-u**) are run as external
-processes. The executables are searched for first in the current
-directory, and then in *PATH*.
+**a8cat** is run as an external processe. The executables is searched
+for first in the current directory, and then in *PATH*.
OPTIONS
=======
@@ -41,8 +40,9 @@ List options
Output raw ATASCII; no translation to the host character set. Must be
used with redirection; **listbas** will not write ATASCII to the terminal.
-**-u**
- Use **a8utf8**\(1) to translate ATASCII to ASCII.
+**-m**
+ Output "magazine listing". Pipes output through **a8cat -m**; see the man
+ page for **a8cat** for details.
.. include:: genopts.rst
@@ -61,9 +61,10 @@ protection.
- **listbas** doesn't show information about the variables. Use **vxrefbas**\(1)
for that.
-- **listbas** will not write ATASCII data to your terminal. Instead, it uses
- **a8eol**\(1) or **a8utf8**\(1) to convert the output to something human-readable
- that won't confuse the terminal.
+- **listbas** will not write ATASCII data to your terminal. By default, it uses
+ **a8cat**\(1) to convert the output to something human-readable
+ that won't confuse the terminal. When outputting raw ATASCII (**-a** option),
+ it refuses to run if standard output is a terminal.
- **listbas** only lists line 32768 (the immediate mode command) if
specifically asked to do so.