From: Sergey Poznyakoff Date: Sat, 29 Jun 2013 12:05:21 +0000 (+0300) Subject: Fix the compatibility check for the --occurrence option. X-Git-Url: https://git.brokenzipper.com/gitweb?a=commitdiff_plain;h=8a834dfa1037758cb42123fd710048cebdc13e7b;p=chaz%2Ftar Fix the compatibility check for the --occurrence option. * src/tar.c (SUBCL_OCCUR): New class. (subcommand_class): Update. (decode_options): Accept the --occurrence option with any subcommand from the SUBCL_OCCUR class. --- diff --git a/src/tar.c b/src/tar.c index b602a5c..9111433 100644 --- a/src/tar.c +++ b/src/tar.c @@ -2352,16 +2352,18 @@ static const char *tar_authors[] = { #define SUBCL_WRITE 0x02 /* subcommand writes to the archive */ #define SUBCL_UPDATE 0x04 /* subcommand updates existing archive */ #define SUBCL_TEST 0x08 /* subcommand tests archive header or meta-info */ +#define SUBCL_OCCUR 0x10 /* subcommand allows the use of the occurrence + option */ static int subcommand_class[] = { /* UNKNOWN_SUBCOMMAND */ 0, /* APPEND_SUBCOMMAND */ SUBCL_WRITE|SUBCL_UPDATE, /* CAT_SUBCOMMAND */ SUBCL_WRITE, /* CREATE_SUBCOMMAND */ SUBCL_WRITE, - /* DELETE_SUBCOMMAND */ SUBCL_WRITE|SUBCL_UPDATE, - /* DIFF_SUBCOMMAND */ SUBCL_READ, - /* EXTRACT_SUBCOMMAND */ SUBCL_READ, - /* LIST_SUBCOMMAND */ SUBCL_READ, + /* DELETE_SUBCOMMAND */ SUBCL_WRITE|SUBCL_UPDATE|SUBCL_OCCUR, + /* DIFF_SUBCOMMAND */ SUBCL_READ|SUBCL_OCCUR, + /* EXTRACT_SUBCOMMAND */ SUBCL_READ|SUBCL_OCCUR, + /* LIST_SUBCOMMAND */ SUBCL_READ|SUBCL_OCCUR, /* UPDATE_SUBCOMMAND */ SUBCL_WRITE|SUBCL_UPDATE, /* TEST_LABEL_SUBCOMMAND */ SUBCL_TEST }; @@ -2532,7 +2534,7 @@ decode_options (int argc, char **argv) if (!args.input_files) USAGE_ERROR ((0, 0, _("--occurrence is meaningless without a file list"))); - if (!IS_SUBCOMMAND_CLASS (SUBCL_READ)) + if (!IS_SUBCOMMAND_CLASS (SUBCL_OCCUR)) USAGE_ERROR ((0, 0, _("--occurrence cannot be used with %s"), subcommand_string (subcommand_option)));