+ off_t block_ordinal;
+ union block *blk;
+ struct tar_stat_info st;
+ static size_t real_s_part_no; /* FIXME */
+
+ real_s_part_no++;
+ memset (&st, 0, sizeof st);
+ st.orig_file_name = st.file_name = real_s_name;
+ st.stat.st_mode = S_IFREG|S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH;
+ st.stat.st_uid = getuid ();
+ st.stat.st_gid = getgid ();
+ st.orig_file_name = xheader_format_name (&st,
+ "%d/GNUFileParts.%p/%f.%n",
+ real_s_part_no);
+ st.file_name = st.orig_file_name;
+ st.archive_file_size = st.stat.st_size = real_s_sizeleft;
+
+ block_ordinal = current_block_ordinal ();
+ blk = start_header (&st);
+ free (st.orig_file_name);
+ if (!blk)
+ abort (); /* FIXME */
+ finish_header (&st, blk, block_ordinal);
+ }
+}
+
+
+/* Add a volume label to the current archive */
+static void
+write_volume_label (void)
+{
+ if (multi_volume_option)
+ add_volume_label ();
+ else
+ _write_volume_label (volume_label_option);
+}
+
+/* Write GNU multi-volume header */
+static void
+gnu_add_multi_volume_header (void)
+{
+ int tmp;
+ union block *block = find_next_block ();
+
+ if (strlen (real_s_name) > NAME_FIELD_SIZE)
+ WARN ((0, 0,
+ _("%s: file name too long to be stored in a GNU multivolume header, truncated"),
+ quotearg_colon (real_s_name)));
+
+ memset (block, 0, BLOCKSIZE);
+
+ /* FIXME: Michael P Urban writes: [a long name file] is being written
+ when a new volume rolls around [...] Looks like the wrong value is
+ being preserved in real_s_name, though. */
+
+ strncpy (block->header.name, real_s_name, NAME_FIELD_SIZE);
+ block->header.typeflag = GNUTYPE_MULTIVOL;
+
+ OFF_TO_CHARS (real_s_sizeleft, block->header.size);
+ OFF_TO_CHARS (real_s_totsize - real_s_sizeleft,
+ block->oldgnu_header.offset);
+
+ tmp = verbose_option;
+ verbose_option = 0;
+ finish_header (¤t_stat_info, block, -1);
+ verbose_option = tmp;
+ set_next_block_after (block);
+}
+
+/* Add a multi volume header to the current archive. The exact header format
+ depends on the archive format. */
+static void
+add_multi_volume_header (void)
+{
+ if (archive_format == POSIX_FORMAT)
+ {
+ off_t d = real_s_totsize - real_s_sizeleft;
+ xheader_store ("GNU.volume.filename", NULL, real_s_name);
+ xheader_store ("GNU.volume.size", NULL, &real_s_sizeleft);
+ xheader_store ("GNU.volume.offset", NULL, &d);