From 772312762986a7ec36262069a28ad3d4dde30559 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Fri, 28 Nov 2025 00:38:24 -0500 Subject: Project has been renamed, use https://slackware.uk/~urchlay/repos/alftools --- src/opts.c | 78 -------------------------------------------------------------- 1 file changed, 78 deletions(-) delete mode 100644 src/opts.c (limited to 'src/opts.c') diff --git a/src/opts.c b/src/opts.c deleted file mode 100644 index 416163c..0000000 --- a/src/opts.c +++ /dev/null @@ -1,78 +0,0 @@ -#include "unalf.h" - -#define OPTIONS "aefklLopqtvVd:x:" - -/* uncomment to test exclude/include glob lists */ -// #define DEBUG_GLOBS - -static void add_exclude(const char *glob) { - if(exclude_count == MAX_EXCLUDES) - return; - exclude_globs[exclude_count++] = glob; -} - -#ifdef DEBUG_GLOBS -static void show_globs(void) { - int i; - - printf("Include globs:\n"); - while(*include_globs) - printf(" + %s\n", *include_globs++); - printf("Exclude globs:\n"); - for(i = 0; i < exclude_count; i++) - printf(" - %s\n", exclude_globs[i]); - exit(0); -} -#endif - -void parse_opts(int argc, char * const *argv) { - int opt; - char **ig; - - /* don't let getopt() print error message for us. */ - opterr = 0; - - while((opt = getopt(argc, argv, OPTIONS)) != -1) { - switch(opt) { - case 'a': opts.txtconv++; break; - case 'e': opts.listonly = opts.testonly = 0; break; - case 'k': opts.keepdot++; break; - case 'f': opts.fixjunk++; opts.testonly = 1; opts.listonly = 0; opts.quiet = 1; break; - case 'l': opts.listonly++; opts.testonly = 0; break; - case 'L': opts.lowercase++; break; - case 'o': opts.overwrite++; break; - case 'p': opts.extract_to_stdout++; opts.quiet++; break; - case 'q': opts.quiet++; break; - case 't': opts.testonly++; opts.listonly = 0; break; - case 'v': opts.listonly = 1; opts.testonly = 0; opts.verbose_list++; break; - case 'V': puts(VERSION); exit(0); break; - case 'd': opts.outdir = optarg; break; - case 'x': add_exclude(optarg); break; - default: - fprintf(stderr, "%s: fatal: invalid option '-%c' (try -h or --help)\n", self, optopt); - exit(1); - } - } - - if(optind >= argc) { - fprintf(stderr, "%s: fatal: missing alf file argument (try -h or --help)\n", self); - exit(1); - } - - in_filename = argv[optind]; - 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(); -#endif -} -- cgit v1.2.3