]> Dogcows Code - chaz/tar/commitdiff
Fix the compatibility check for the --occurrence option.
authorSergey Poznyakoff <gray@gnu.org.ua>
Sat, 29 Jun 2013 12:05:21 +0000 (15:05 +0300)
committerSergey Poznyakoff <gray@gnu.org.ua>
Sat, 29 Jun 2013 12:05:21 +0000 (15:05 +0300)
* src/tar.c (SUBCL_OCCUR): New class.
(subcommand_class): Update.
(decode_options): Accept the --occurrence option
with any subcommand from the SUBCL_OCCUR class.

src/tar.c

index b602a5c2f60a2d859a38689408b422d97ffe3f0a..91114332356842aa4c68974eeac1d2f2ce73dacc 100644 (file)
--- 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)));
This page took 0.023843 seconds and 4 git commands to generate.