+ while (size > 0);
+
+ xheader_destroy (&extended_header);
+ header = find_next_block ();
+ memcpy (header, &hp.buffer, sizeof (hp.buffer));
+ return header;
+}
+
+\f
+/* Header handling. */
+
+/* Make a header block for the file whose stat info is st,
+ and return its address. */
+
+static union block *
+start_header (const char *name, struct tar_stat_info *st)
+{
+ union block *header;
+
+ name = safer_name_suffix (name, 0);
+
+ if (sizeof header->header.name <= strlen (name))
+ write_long (name, GNUTYPE_LONGNAME);
+
+ header = find_next_block ();
+ memset (header->buffer, 0, sizeof (union block));
+
+ assign_string (¤t_stat_info.file_name, name);
+
+ strncpy (header->header.name, name, NAME_FIELD_SIZE);
+ header->header.name[NAME_FIELD_SIZE - 1] = '\0';
+
+ /* Override some stat fields, if requested to do so. */
+
+ if (owner_option != (uid_t) -1)
+ st->stat.st_uid = owner_option;
+ if (group_option != (gid_t) -1)
+ st->stat.st_gid = group_option;
+ if (mode_option)
+ st->stat.st_mode = ((st->stat.st_mode & ~MODE_ALL)
+ | mode_adjust (st->stat.st_mode, mode_option));
+
+ /* Paul Eggert tried the trivial test ($WRITER cf a b; $READER tvf a)
+ for a few tars and came up with the following interoperability
+ matrix:
+
+ WRITER
+ 1 2 3 4 5 6 7 8 9 READER
+ . . . . . . . . . 1 = SunOS 4.2 tar
+ # . . # # . . # # 2 = NEC SVR4.0.2 tar
+ . . . # # . . # . 3 = Solaris 2.1 tar
+ . . . . . . . . . 4 = GNU tar 1.11.1
+ . . . . . . . . . 5 = HP-UX 8.07 tar
+ . . . . . . . . . 6 = Ultrix 4.1
+ . . . . . . . . . 7 = AIX 3.2
+ . . . . . . . . . 8 = Hitachi HI-UX 1.03
+ . . . . . . . . . 9 = Omron UNIOS-B 4.3BSD 1.60Beta
+
+ . = works
+ # = ``impossible file type''
+
+ The following mask for old archive removes the `#'s in column 4
+ above, thus making GNU tar both a universal donor and a universal
+ acceptor for Paul's test. */
+
+ if (archive_format == V7_FORMAT)
+ MODE_TO_CHARS (st->stat.st_mode & MODE_ALL, header->header.mode);
+ else
+ MODE_TO_CHARS (st->stat.st_mode, header->header.mode);
+
+ if (st->stat.st_uid > MAXOCTAL7 && archive_format == POSIX_FORMAT)
+ xheader_store ("uid", st);
+ else
+ UID_TO_CHARS (st->stat.st_uid, header->header.uid);
+
+ if (st->stat.st_gid > MAXOCTAL7 && archive_format == POSIX_FORMAT)
+ xheader_store ("gid", st);
+ else
+ GID_TO_CHARS (st->stat.st_gid, header->header.gid);