+
+ increase_volume_number ();
+ return true;
+}
+
+\f
+/* Check the LABEL block against the volume label, seen as a globbing
+ pattern. Return true if the pattern matches. In case of failure,
+ retry matching a volume sequence number before giving up in
+ multi-volume mode. */
+static bool
+check_label_pattern (union block *label)
+{
+ char *string;
+ bool result;
+
+ if (! memchr (label->header.name, '\0', sizeof label->header.name))
+ return false;
+
+ if (fnmatch (volume_label_option, label->header.name, 0) == 0)
+ return true;
+
+ if (!multi_volume_option)
+ return false;
+
+ string = xmalloc (strlen (volume_label_option)
+ + sizeof VOLUME_LABEL_APPEND + 1);
+ strcpy (string, volume_label_option);
+ strcat (string, VOLUME_LABEL_APPEND);
+ result = fnmatch (string, label->header.name, 0) == 0;
+ free (string);
+ return result;
+}
+
+/* Check if the next block contains a volume label and if this matches
+ the one given in the command line */
+static void
+match_volume_label (void)
+{
+ union block *label = find_next_block ();
+
+ if (!label)
+ FATAL_ERROR ((0, 0, _("Archive not labeled to match %s"),
+ quote (volume_label_option)));
+ if (!check_label_pattern (label))
+ FATAL_ERROR ((0, 0, _("Volume %s does not match %s"),
+ quote_n (0, label->header.name),
+ quote_n (1, volume_label_option)));
+}
+
+/* Mark the archive with volume label STR. */
+static void
+_write_volume_label (const char *str)
+{
+ if (archive_format == POSIX_FORMAT)
+ xheader_store ("GNU.volume.label", NULL, str);