aboutsummaryrefslogtreecommitdiff
path: root/src/opts.c
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2025-11-21 06:07:42 -0500
committerB. Watson <urchlay@slackware.uk>2025-11-21 06:07:42 -0500
commit610086ad82c30cb86ff7b011b1d2e4b38a748df0 (patch)
tree8ccb7fd63881109c052af278252816d419a5c1d0 /src/opts.c
parent44541066424e2ff1490f25a2b512a1a609506243 (diff)
downloadunalf-610086ad82c30cb86ff7b011b1d2e4b38a748df0.tar.gz
Check for wildcards matching *.alf; generally this is an error.
Diffstat (limited to 'src/opts.c')
-rw-r--r--src/opts.c13
1 files changed, 12 insertions, 1 deletions
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();