diff options
Diffstat (limited to 'src/opts.c')
| -rw-r--r-- | src/opts.c | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -1,6 +1,6 @@ #include "unalf.h" -#define OPTIONS "aefFklLopqtTvVd:x:" +#define OPTIONS "aefFklLon:pqstTvVd:x:" /* uncomment to test exclude/include glob lists */ // #define DEBUG_GLOBS @@ -25,6 +25,10 @@ static void show_globs(void) { } #endif +int parsenum(const char opt, const char *arg) { + return atoi(arg); /* TODO: use strtol(), die on error */ +} + void parse_opts(int argc, char * const *argv) { int opt; char **ig; @@ -41,9 +45,11 @@ void parse_opts(int argc, char * const *argv) { case 'F': opts.force++; break; case 'l': opts.listonly++; opts.testonly = 0; break; case 'L': opts.lowercase++; break; + case 'n': opts.extract_num = parsenum('n', optarg); break; case 'o': opts.overwrite++; break; case 'p': opts.extract_to_stdout++; opts.quiet++; break; case 'q': opts.quiet++; break; + case 's': opts.split++; opts.testonly = 0; opts.listonly = 0; break; case 't': opts.testonly++; opts.listonly = 0; break; case 'T': opts.ignore_datetime = 1; break; case 'v': opts.listonly = 1; opts.testonly = 0; opts.verbose_list++; break; |
