+list_archive (void)
+{
+ /* Print the header block. */
+
+ if (verbose_option)
+ {
+ if (verbose_option > 1)
+ decode_header (current_header, ¤t_stat, ¤t_format, 0);
+ print_header ();
+ }
+
+ if (incremental_option && current_header->header.typeflag == GNUTYPE_DUMPDIR)
+ {
+ off_t size;
+ size_t written, check;
+ union block *data_block;
+
+ set_next_block_after (current_header);
+ if (multi_volume_option)
+ {
+ assign_string (&save_name, current_file_name);
+ save_totsize = current_stat.st_size;
+ }
+ for (size = current_stat.st_size; size > 0; size -= written)
+ {
+ if (multi_volume_option)
+ save_sizeleft = size;
+ data_block = find_next_block ();
+ if (!data_block)
+ {
+ ERROR ((0, 0, _("EOF in archive file")));
+ break; /* FIXME: What happens, then? */
+ }
+ written = available_space_after (data_block);
+ if (written > size)
+ written = size;
+ errno = 0; /* FIXME: errno should be read-only */
+ check = fwrite (data_block->buffer, sizeof (char), written, stdlis);
+ set_next_block_after ((union block *)
+ (data_block->buffer + written - 1));
+ if (check != written)
+ {
+ ERROR ((0, errno, _("Only wrote %lu of %lu bytes to file %s"),
+ (unsigned long) check,
+ (unsigned long) written, current_file_name));
+ skip_file (size - written);
+ break;
+ }
+ }
+ if (multi_volume_option)
+ assign_string (&save_name, NULL);
+ fputc ('\n', stdlis);
+ fflush (stdlis);
+ return;
+
+ }
+
+ /* Skip past the header in the archive, and past any extended headers. */
+
+ set_next_block_after (current_header);
+ if (current_header->oldgnu_header.isextended)
+ skip_extended_headers ();
+
+ if (multi_volume_option)
+ assign_string (&save_name, current_file_name);
+
+ /* Skip to the next header on the archive. */
+
+ skip_file (current_stat.st_size);
+
+ if (multi_volume_option)
+ assign_string (&save_name, NULL);
+}
+
+/*-----------------------------------------------------------------------.
+| Read a block that's supposed to be a header block. Return its address |
+| in "current_header", and if it is good, the file's size in |
+| current_stat.st_size. |
+| |
+| Return 1 for success, 0 if the checksum is bad, EOF on eof, 2 for a |
+| block full of zeros (EOF marker). |
+| |
+| You must always set_next_block_after(current_header) to skip past the |
+| header which this routine reads. |
+`-----------------------------------------------------------------------*/
+
+/* The standard BSD tar sources create the checksum by adding up the
+ bytes in the header as type char. I think the type char was unsigned
+ on the PDP-11, but it's signed on the Next and Sun. It looks like the
+ sources to BSD tar were never changed to compute the checksum
+ currectly, so both the Sun and Next add the bytes of the header as
+ signed chars. This doesn't cause a problem until you get a file with
+ a name containing characters with the high bit set. So read_header
+ computes two checksums -- signed and unsigned. */
+
+enum read_header
+read_header (void)