aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-07-16 14:58:45 -0400
committerB. Watson <urchlay@slackware.uk>2024-07-16 14:58:45 -0400
commit21ed0c9090c6bab5e315474cd3a959abeb70ac11 (patch)
treedc0c77ad91fb9e08def19068d893d797d3fb0d73
parentf40d6851514c7840a8d068689c28e6df83c68fbe (diff)
downloadbw-atari8-tools-21ed0c9090c6bab5e315474cd3a959abeb70ac11.tar.gz
listbas: remove -A option, make autodetect the default.
-rw-r--r--listbas.126
-rw-r--r--listbas.c9
-rw-r--r--listbas.rst26
3 files changed, 28 insertions, 33 deletions
diff --git a/listbas.1 b/listbas.1
index 37ecd69..f4160de 100644
--- a/listbas.1
+++ b/listbas.1
@@ -42,40 +42,38 @@ format.
By default, output is Unicode in UTF\-8 encoding, with ANSI/VT220
escape sequences for inverse video and color syntax highlighting.
.sp
-\fBlistbas\fP supports several BASIC dialects used on the Atari; see
-the \fB\-b\fP option for details.
+\fBlistbas\fP supports several BASIC dialects used on the Atari. By
+default, the BASIC dialect is autodetected by running \fBwhichbas\fP(1)
+as an external process.
.SH OPTIONS
.SS BASIC options
.INDENT 0.0
.TP
-.B \fB\-A\fP
-Autodetect the BASIC dialect. Runs \fBwhichbas\fP(1) as an external
-process, so it must be available on \fB$PATH\fP\&. Someday, this will
-be enabled by default...
-.TP
.B \fB\-b\fP
-Set the BASIC dialect the program was written in. Choices are:
+Set the BASIC dialect the program was written in. This disables
+autodetection. Supported dialects are:
.INDENT 7.0
.TP
.B \fB\-ba\fP
-Program is Atari BASIC; this is the default.
+Atari BASIC.
.TP
.B \fB\-ba+\fP
-Program is OSS BASIC/A+.
+OSS BASIC/A+.
.TP
.B \fB\-bt\fP
-Program is Turbo BASIC XL.
+Turbo BASIC XL.
.TP
.B \fB\-bxl\fP
-Program is OSS BASIC XL.
+OSS BASIC XL.
.TP
.B \fB\-bxe\fP
-Program is OSS BASIC XE.
+OSS BASIC XE.
.UNINDENT
.sp
If you see lots of "bad token XX" messages, or if the code just doesn\(aqt
make any sense, you\(aqre using the wrong BASIC option. \fBwhichbas\fP(1)
-can (usually) detect the BASIC a program was written in.
+can usually detect the BASIC a program was written in, but if the
+results are ambiguous, \fBlistbas\fP will assume Turbo BASIC XL.
.TP
.B \fB\-i\fP
Include the immediate mode command (line 32768) in the output.
diff --git a/listbas.c b/listbas.c
index d0a87fd..8c55f99 100644
--- a/listbas.c
+++ b/listbas.c
@@ -76,7 +76,7 @@ int immediate = 0; /* 1 with -i */
int underline = 0; /* 1 with -u */
int skip_lineno = 0; /* 1 with -l */
int dump_tables = 0; /* 1 with -D */
-int autodetect = 0; /* 1 with -a */
+int autodetect = 1; /* 0 with -b */
/* change these with -c */
int color_cmd = C_YELLOW;
@@ -167,14 +167,13 @@ void parse_args(int argc, char **argv, int from_env) {
optind = 1;
- while( (opt = getopt(argc, argv, "ADb:UCviamnBdhxulc:")) != -1) {
+ while( (opt = getopt(argc, argv, "Db:UCviamnBdhxulc:")) != -1) {
switch(opt) {
case 'U': output_mode = M_UTF8; break;
case 'a': output_mode = M_ATASCII; break;
case 'm': output_mode = M_MAG; break;
case 'd': output_mode = M_DOTS; break;
case 'x': output_mode = M_UTF8_I; break;
- case 'A': autodetect = 1; break;
case 'D': dump_tables = 1; break;
case 'v': verbose = 1; break;
case 'i': immediate = 1; break;
@@ -183,7 +182,7 @@ void parse_args(int argc, char **argv, int from_env) {
case 'C': color = 1; break;
case 'n': color = 0; break;
case 'l': skip_lineno = 1; break;
- case 'b': bas_type = get_bas_type(optarg); break;
+ case 'b': autodetect = 0; bas_type = get_bas_type(optarg); break;
case 'c': parse_color_scheme(optarg); break;
case 'h': print_help(); exit(0);
default:
@@ -764,7 +763,7 @@ void detect_bas_dialect() {
} else {
/* we are the child */
if(execvp(args[0], (char * const *)args) < 0) {
- perror("exec()");
+ perror("Can't execute whichbas");
exit(1);
}
}
diff --git a/listbas.rst b/listbas.rst
index 6b31319..57ba0f8 100644
--- a/listbas.rst
+++ b/listbas.rst
@@ -23,8 +23,9 @@ format.
By default, output is Unicode in UTF-8 encoding, with ANSI/VT220
escape sequences for inverse video and color syntax highlighting.
-**listbas** supports several BASIC dialects used on the Atari; see
-the **-b** option for details.
+**listbas** supports several BASIC dialects used on the Atari. By
+default, the BASIC dialect is autodetected by running **whichbas**\(1)
+as an external process.
OPTIONS
=======
@@ -32,32 +33,29 @@ OPTIONS
BASIC options
-------------
-**-A**
- Autodetect the BASIC dialect. Runs **whichbas**\(1) as an external
- process, so it must be available on **$PATH**. Someday, this will
- be enabled by default...
-
**-b**
- Set the BASIC dialect the program was written in. Choices are:
+ Set the BASIC dialect the program was written in. This disables
+ autodetection. Supported dialects are:
**-ba**
- Program is Atari BASIC; this is the default.
+ Atari BASIC.
**-ba+**
- Program is OSS BASIC/A+.
+ OSS BASIC/A+.
**-bt**
- Program is Turbo BASIC XL.
+ Turbo BASIC XL.
**-bxl**
- Program is OSS BASIC XL.
+ OSS BASIC XL.
**-bxe**
- Program is OSS BASIC XE.
+ OSS BASIC XE.
If you see lots of "bad token XX" messages, or if the code just doesn't
make any sense, you're using the wrong BASIC option. **whichbas**\(1)
- can (usually) detect the BASIC a program was written in.
+ can usually detect the BASIC a program was written in, but if the
+ results are ambiguous, **listbas** will assume Turbo BASIC XL.
**-i**
Include the immediate mode command (line 32768) in the output.