From 610086ad82c30cb86ff7b011b1d2e4b38a748df0 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 21 Nov 2025 06:07:42 -0500 Subject: Check for wildcards matching *.alf; generally this is an error. --- src/opts.c | 13 ++++++++++++- src/unalf.1 | 7 +++++++ src/unalf.rst | 7 +++++++ 3 files changed, 26 insertions(+), 1 deletion(-) diff --git a/src/opts.c b/src/opts.c index 3120317..3237642 100644 --- a/src/opts.c +++ b/src/opts.c @@ -27,6 +27,7 @@ static void show_globs(void) { void parse_opts(int argc, char * const *argv) { int opt; + char **ig; while((opt = getopt(argc, argv, OPTIONS)) != -1) { switch(opt) { @@ -55,7 +56,17 @@ void parse_opts(int argc, char * const *argv) { } in_filename = argv[optind]; - include_globs = &argv[optind + 1]; /* might be null, that's OK */ + if(optind < argc) + include_globs = &argv[optind + 1]; /* might be null, that's OK */ + + ig = (char **)include_globs; + while(*ig) { + if(globmatch("*.alf", *ig)) { + fprintf(stderr, "%s: ALF files don't normally contain other ALF files, are you trying to extract/list multiple ALF files at once?\n", self); + break; + } + ig++; + } #ifdef DEBUG_GLOBS show_globs(); diff --git a/src/unalf.1 b/src/unalf.1 index 383974c..7d7615c 100644 --- a/src/unalf.1 +++ b/src/unalf.1 @@ -301,6 +301,13 @@ that big. Not an actual problem, unless you try to extract this ALF file on an Atari running Atari DOS 2.0/2.5, or any other DOS that doesn\(aqt allow underscores in filenames. +.TP +.B \fBALF files don\(aqt normally contain other ALF files, are you trying to extract/list multiple ALF files at once?\fP +You gave a \fIwildcard\fP argument that ends with \fI\&.alf\fP\&. This is OK if +your \fIALF\fP file actually contains another \fIALF\fP file, but that would +be a pathological case. Most likely, you\(aqre trying to extract multiple +\fIALF\fP files with one command, which doesn\(aqt work. Use one \fBunalf\fP +command per file. .UNINDENT .SH NOTES .sp diff --git a/src/unalf.rst b/src/unalf.rst index 32a3982..7ba2f0a 100644 --- a/src/unalf.rst +++ b/src/unalf.rst @@ -256,6 +256,13 @@ Besides the standard error messages such as "no such file or directory": an Atari running Atari DOS 2.0/2.5, or any other DOS that doesn't allow underscores in filenames. +**ALF files don't normally contain other ALF files, are you trying to extract/list multiple ALF files at once?** + You gave a *wildcard* argument that ends with *.alf*. This is OK if + your *ALF* file actually contains another *ALF* file, but that would + be a pathological case. Most likely, you're trying to extract multiple + *ALF* files with one command, which doesn't work. Use one **unalf** + command per file. + NOTES ===== -- cgit v1.2.3