aboutsummaryrefslogtreecommitdiff
path: root/src/opts.c
diff options
context:
space:
mode:
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();