diff options
| author | B. Watson <urchlay@slackware.uk> | 2025-11-21 06:07:42 -0500 |
|---|---|---|
| committer | B. Watson <urchlay@slackware.uk> | 2025-11-21 06:07:42 -0500 |
| commit | 610086ad82c30cb86ff7b011b1d2e4b38a748df0 (patch) | |
| tree | 8ccb7fd63881109c052af278252816d419a5c1d0 /src/opts.c | |
| parent | 44541066424e2ff1490f25a2b512a1a609506243 (diff) | |
| download | unalf-610086ad82c30cb86ff7b011b1d2e4b38a748df0.tar.gz | |
Check for wildcards matching *.alf; generally this is an error.
Diffstat (limited to 'src/opts.c')
| -rw-r--r-- | src/opts.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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(); |
