- written = available_space_after (data_block);
- if (written > size)
- written = size;
-
- memcpy (bp, data_block->buffer, written);
- bp += written;
- set_next_block_after ((union block *)
- (data_block->buffer + written - 1));
+ else
+ {
+ if (next_long_link)
+ free (next_long_link);
+ next_long_link = header_copy;
+ next_long_link_blocks = size / BLOCKSIZE;
+ }
+
+ set_next_block_after (header);
+ *header_copy = *header;
+ bp = header_copy->buffer + BLOCKSIZE;
+
+ for (size -= BLOCKSIZE; size > 0; size -= written)
+ {
+ data_block = find_next_block ();
+ if (! data_block)
+ {
+ ERROR ((0, 0, _("Unexpected EOF in archive")));
+ break;
+ }
+ written = available_space_after (data_block);
+ if (written > size)
+ written = size;
+
+ memcpy (bp, data_block->buffer, written);
+ bp += written;
+ set_next_block_after ((union block *)
+ (data_block->buffer + written - 1));
+ }
+
+ *bp = '\0';
+ }
+ else if (header->header.typeflag == XHDTYPE)
+ xheader_read (header, OFF_FROM_HEADER (header->header.size));
+ else if (header->header.typeflag == XGLTYPE)
+ {
+ xheader_read (header, OFF_FROM_HEADER (header->header.size));
+ xheader_decode_global ();