static void
assert_format(unsigned fmt_mask)
{
- if ((FORMAT_MASK(archive_format) & fmt_mask) == 0)
+ if ((FORMAT_MASK (archive_format) & fmt_mask) == 0)
USAGE_ERROR ((0, 0,
_("GNU features wanted on incompatible archive format")));
}
SAME_OWNER_OPTION,
SHOW_DEFAULTS_OPTION,
SHOW_OMITTED_DIRS_OPTION,
+ SHOW_STORED_NAMES_OPTION,
STRIP_COMPONENTS_OPTION,
SUFFIX_OPTION,
+ TEST_LABEL_OPTION,
TO_COMMAND_OPTION,
TOTALS_OPTION,
UNQUOTE_OPTION,
{"concatenate", 0, 0, OPTION_ALIAS, NULL, 10},
{"delete", DELETE_OPTION, 0, 0,
N_("delete from the archive (not on mag tapes!)"), 10 },
+ {"test-label", TEST_LABEL_OPTION, NULL, 0,
+ N_("Test archive volume label and exit"), 10 },
{NULL, 0, NULL, 0,
N_("Operation modifiers:"), 20},
N_("Show tar defaults"), 102 },
{"show-omitted-dirs", SHOW_OMITTED_DIRS_OPTION, 0, 0,
N_("When listing or extracting, list each directory that does not match search criteria"), 102 },
+ {"show-stored-names", SHOW_STORED_NAMES_OPTION, 0, 0,
+ N_("When creating archive in verbose mode, list member names as stored in the archive"),
+ 102 },
{NULL, 0, NULL, 0,
N_("Compatibility options:"), 110 },
verbose_option++;
break;
+ case TEST_LABEL_OPTION:
+ set_subcommand_option (LIST_SUBCOMMAND);
+ test_label_option = true;
+ break;
+
case 'T':
update_argv (arg, state);
/* Indicate we've been given -T option. This is for backward
show_omitted_dirs_option = true;
break;
+ case SHOW_STORED_NAMES_OPTION:
+ show_stored_names_option = true;
+ break;
+
case SUFFIX_OPTION:
backup_option = true;
args->backup_suffix_string = arg;
archive_format = DEFAULT_ARCHIVE_FORMAT;
}
+ /* FIXME: Merge the four conditionals below */
if (volume_label_option && subcommand_option == CREATE_SUBCOMMAND)
assert_format (FORMAT_MASK (OLDGNU_FORMAT)
- | FORMAT_MASK (GNU_FORMAT));
+ | FORMAT_MASK (GNU_FORMAT)
+ | FORMAT_MASK (POSIX_FORMAT));
+
+ if (incremental_option)
+ assert_format (FORMAT_MASK (OLDGNU_FORMAT)
+ | FORMAT_MASK (GNU_FORMAT)
+ | FORMAT_MASK (POSIX_FORMAT));
- if (incremental_option || multi_volume_option)
- assert_format (FORMAT_MASK (OLDGNU_FORMAT) | FORMAT_MASK (GNU_FORMAT));
+ if (multi_volume_option)
+ assert_format (FORMAT_MASK (OLDGNU_FORMAT)
+ | FORMAT_MASK (GNU_FORMAT)
+ | FORMAT_MASK (POSIX_FORMAT));
if (sparse_option)
assert_format (FORMAT_MASK (OLDGNU_FORMAT)
{
if (multi_volume_option)
USAGE_ERROR ((0, 0, _("Cannot use multi-volume compressed archives")));
- if (subcommand_option == UPDATE_SUBCOMMAND)
+ if (subcommand_option == UPDATE_SUBCOMMAND
+ || subcommand_option == APPEND_SUBCOMMAND)
USAGE_ERROR ((0, 0, _("Cannot update compressed archives")));
+ if (subcommand_option == CAT_SUBCOMMAND)
+ USAGE_ERROR ((0, 0, _("Cannot concatenate compressed archives")));
}
/* It is no harm to use --pax-option on non-pax archives in archive
if (recursive_unlink_option)
old_files_option = UNLINK_FIRST_OLD_FILES;
- if (utc_option)
+
+ if (test_label_option)
+ {
+ /* --test-label is silent if the user has specified the label name to
+ compare against. */
+ if (args.input_files == 0)
+ verbose_option++;
+ }
+ else if (utc_option)
verbose_option = 2;
/* Forbid using -c with no input files whatsoever. Check that `-f -',
free (st->uname);
free (st->gname);
free (st->sparse_map);
+ free (st->dumpdir);
memset (st, 0, sizeof (*st));
}
+
+/* Format mask for all available formats that support nanosecond
+ timestamp resolution. */
+#define NS_PRECISION_FORMAT_MASK FORMAT_MASK (POSIX_FORMAT)
+
+/* Same as timespec_cmp, but ignore nanoseconds if current archive
+ format does not provide sufficient resolution. */
+int
+tar_timespec_cmp (struct timespec a, struct timespec b)
+{
+ if (!(FORMAT_MASK (current_format) & NS_PRECISION_FORMAT_MASK))
+ a.tv_nsec = b.tv_nsec = 0;
+ return timespec_cmp (a, b);
+}