aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-03-08 22:39:42 -0500
committerB. Watson <urchlay@slackware.uk>2025-03-08 22:39:42 -0500
commitfd1128f0742913f0f6e9a5da47ab0d23e7cf95f3 (patch)
tree4d312c6e880dc0b13c39cd809f0edb02e39bdf33
parent1a45a059148e15e540312b2b6bd527245e809cc4 (diff)
downloadbw-atari8-tools-fd1128f0742913f0f6e9a5da47ab0d23e7cf95f3.tar.gz
listamsb: allow overriding a8cat path in environment.
-rw-r--r--listamsb.113
-rw-r--r--listamsb.c12
-rw-r--r--listamsb.rst10
3 files changed, 34 insertions, 1 deletions
diff --git a/listamsb.1 b/listamsb.1
index 1302ae6..f1b34e0 100644
--- a/listamsb.1
+++ b/listamsb.1
@@ -27,7 +27,7 @@ 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 "LISTAMSB" 1 "2025-03-07" "0.2.1" "Urchlay's Atari 8-bit Tools"
+.TH "LISTAMSB" 1 "2025-03-08" "0.2.1" "Urchlay's Atari 8-bit Tools"
.SH NAME
listamsb \- List the source of a tokenized Atari Microsoft BASIC program
.SH SYNOPSIS
@@ -239,6 +239,17 @@ of Microsoft BASIC (e.g. Commodore, AppleSoft, GW\-BASIC, TRS\-80). If
you see this warning, you\(aqll also see \fIN\fP <unknown token \fIXX\fP>
messages in the actual listing.
.UNINDENT
+.SH ENVIRONMENT
+.sp
+\fBA8CAT\fP
+.INDENT 0.0
+.INDENT 3.5
+The path to the \fBa8cat\fP(1) binary. Can be a full path or just
+the executable name, in which case it will be searched for with the
+normal \fBPATH\fP mechanism. If not set, \fIa8cat\fP is used. If there are
+spaces or other metacharacters, they must be escaped.
+.UNINDENT
+.UNINDENT
.SH LIMITATIONS
.sp
Unlike \fBlistbas\fP, there\(aqs no color syntax highlighting. Probably there
diff --git a/listamsb.c b/listamsb.c
index 7195443..7d9ca81 100644
--- a/listamsb.c
+++ b/listamsb.c
@@ -751,9 +751,15 @@ void get_line_range(const char *arg) {
}
void parse_args(int argc, char **argv) {
+ const char *a8cat;
char tmp[10];
int opt;
+ a8cat = getenv("A8CAT");
+ if(!a8cat) a8cat = "a8cat";
+
+ strncpy(pipe_command, a8cat, BUFSIZ);
+
if(argc >= 2) {
if(strcmp(argv[1], "--help") == 0) {
print_help();
@@ -832,6 +838,12 @@ void open_output() {
outfile = stdout;
verbose(1, "using stdout for output");
} else {
+ const char *a8cat;
+ if((a8cat = getenv("A8CAT"))) {
+ verbose(1, "read A8CAT=%s from environment", a8cat);
+ } else {
+ verbose(1, "A8CAT not set in environment, using 'a8cat'");
+ }
verbose(1, "using pipe for output: %s", pipe_command);
outfile = popen(pipe_command, "w"); /* "wb" not allowed! */
/* we probably never see this error. popen() fails only if
diff --git a/listamsb.rst b/listamsb.rst
index a76c22b..902319b 100644
--- a/listamsb.rst
+++ b/listamsb.rst
@@ -223,6 +223,16 @@ continues processing.
you see this warning, you'll also see *N* <unknown token *XX*>
messages in the actual listing.
+ENVIRONMENT
+===========
+
+**A8CAT**
+
+ The path to the **a8cat**\(1) binary. Can be a full path or just
+ the executable name, in which case it will be searched for with the
+ normal **PATH** mechanism. If not set, *a8cat* is used. If there are
+ spaces or other metacharacters, they must be escaped.
+
LIMITATIONS
===========