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 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/opts.c') 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(); -- cgit v1.2.3