1 /* List a tar archive, with support routines for reading a tar archive.
2 Copyright 1988,92,93,94,96,97,98,1999 Free Software Foundation, Inc.
3 Written by John Gilmore, on 1985-08-26.
5 This program is free software; you can redistribute it and/or modify it
6 under the terms of the GNU General Public License as published by the
7 Free Software Foundation; either version 2, or (at your option) any later
10 This program is distributed in the hope that it will be useful, but
11 WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
13 Public License for more details.
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
19 /* Define to non-zero for forcing old ctime() instead of isotime(). */
27 #ifndef FNM_LEADING_DIR
33 union block
*current_header
; /* points to current archive header */
34 struct stat current_stat
; /* stat struct corresponding */
35 enum archive_format current_format
; /* recognized format */
37 static uintmax_t from_oct
PARAMS ((const char *, size_t, const char *, uintmax_t));
40 /*-----------------------------------.
41 | Main loop for reading an archive. |
42 `-----------------------------------*/
45 read_and (void (*do_something
) ())
47 enum read_header status
= HEADER_STILL_UNREAD
;
48 enum read_header prev_status
;
52 open_archive (ACCESS_READ
);
57 status
= read_header ();
60 case HEADER_STILL_UNREAD
:
65 /* Valid header. We should decode next field (mode) first.
66 Ensure incoming names are null terminated. */
68 /* FIXME: This is a quick kludge before 1.12 goes out. */
69 current_stat
.st_mtime
= TIME_FROM_OCT (current_header
->header
.mtime
);
71 if (!name_match (current_file_name
)
72 || current_stat
.st_mtime
< newer_mtime_option
73 || excluded_pathname (excluded
, current_file_name
))
77 if (current_header
->header
.typeflag
== GNUTYPE_VOLHDR
78 || current_header
->header
.typeflag
== GNUTYPE_MULTIVOL
79 || current_header
->header
.typeflag
== GNUTYPE_NAMES
)
84 if (show_omitted_dirs_option
85 && current_header
->header
.typeflag
== DIRTYPE
)
86 WARN ((0, 0, _("Omitting %s"), current_file_name
));
88 /* Skip past it in the archive. */
90 if (current_header
->oldgnu_header
.isextended
)
92 save_typeflag
= current_header
->header
.typeflag
;
93 set_next_block_after (current_header
);
101 exhdr
= find_next_block ();
102 if (!exhdr
->sparse_header
.isextended
)
104 set_next_block_after (exhdr
);
108 set_next_block_after (exhdr
);
110 skip_extended_headers ();
113 /* Skip to the next header on the archive. */
115 if (save_typeflag
!= DIRTYPE
)
116 skip_file (current_stat
.st_size
);
123 case HEADER_ZERO_BLOCK
:
124 if (block_number_option
)
126 char buf
[UINTMAX_STRSIZE_BOUND
];
127 fprintf (stdlis
, _("block %s: ** Block of NULs **\n"),
128 STRINGIFY_BIGINT (current_block_ordinal (), buf
));
131 set_next_block_after (current_header
);
132 status
= prev_status
;
133 if (ignore_zeros_option
)
137 case HEADER_END_OF_FILE
:
138 if (block_number_option
)
140 char buf
[UINTMAX_STRSIZE_BOUND
];
141 fprintf (stdlis
, _("block %s: ** End of File **\n"),
142 STRINGIFY_BIGINT (current_block_ordinal (), buf
));
147 /* If the previous header was good, tell them that we are
148 skipping bad ones. */
149 set_next_block_after (current_header
);
152 case HEADER_STILL_UNREAD
:
153 WARN ((0, 0, _("Hmm, this doesn't look like a tar archive")));
156 case HEADER_ZERO_BLOCK
:
158 WARN ((0, 0, _("Skipping to next file header")));
161 case HEADER_END_OF_FILE
:
163 /* We are in the middle of a cascade of errors. */
171 apply_delayed_set_stat ();
173 names_notfound (); /* print names not found */
176 /*---------------------------------------------.
177 | Print a header block, based on tar options. |
178 `---------------------------------------------*/
183 int isextended
= 0; /* to remember if current_header is extended */
185 /* Print the header block. */
189 if (verbose_option
> 1)
190 decode_header (current_header
, ¤t_stat
, ¤t_format
, 0);
194 if (incremental_option
&& current_header
->header
.typeflag
== GNUTYPE_DUMPDIR
)
197 size_t written
, check
;
198 union block
*data_block
;
200 set_next_block_after (current_header
);
201 if (multi_volume_option
)
203 assign_string (&save_name
, current_file_name
);
204 save_totsize
= current_stat
.st_size
;
206 for (size
= current_stat
.st_size
; size
> 0; size
-= written
)
208 if (multi_volume_option
)
209 save_sizeleft
= size
;
210 data_block
= find_next_block ();
213 ERROR ((0, 0, _("EOF in archive file")));
214 break; /* FIXME: What happens, then? */
216 written
= available_space_after (data_block
);
219 errno
= 0; /* FIXME: errno should be read-only */
220 check
= fwrite (data_block
->buffer
, sizeof (char), written
, stdlis
);
221 set_next_block_after ((union block
*)
222 (data_block
->buffer
+ written
- 1));
223 if (check
!= written
)
225 ERROR ((0, errno
, _("Only wrote %lu of %lu bytes to file %s"),
226 (unsigned long) check
,
227 (unsigned long) written
, current_file_name
));
228 skip_file (size
- written
);
232 if (multi_volume_option
)
233 assign_string (&save_name
, NULL
);
234 fputc ('\n', stdlis
);
240 /* Check to see if we have an extended header to skip over also. */
242 if (current_header
->oldgnu_header
.isextended
)
245 /* Skip past the header in the archive. */
247 set_next_block_after (current_header
);
249 /* If we needed to skip any extended headers, do so now, by reading
250 extended headers and skipping past them in the archive. */
259 exhdr
= find_next_block ();
261 if (!exhdr
->sparse_header
.isextended
)
263 set_next_block_after (exhdr
);
266 set_next_block_after (exhdr
);
269 skip_extended_headers ();
272 if (multi_volume_option
)
273 assign_string (&save_name
, current_file_name
);
275 /* Skip to the next header on the archive. */
277 skip_file (current_stat
.st_size
);
279 if (multi_volume_option
)
280 assign_string (&save_name
, NULL
);
283 /*-----------------------------------------------------------------------.
284 | Read a block that's supposed to be a header block. Return its address |
285 | in "current_header", and if it is good, the file's size in |
286 | current_stat.st_size. |
288 | Return 1 for success, 0 if the checksum is bad, EOF on eof, 2 for a |
289 | block full of zeros (EOF marker). |
291 | You must always set_next_block_after(current_header) to skip past the |
292 | header which this routine reads. |
293 `-----------------------------------------------------------------------*/
295 /* The standard BSD tar sources create the checksum by adding up the
296 bytes in the header as type char. I think the type char was unsigned
297 on the PDP-11, but it's signed on the Next and Sun. It looks like the
298 sources to BSD tar were never changed to compute the checksum
299 currectly, so both the Sun and Next add the bytes of the header as
300 signed chars. This doesn't cause a problem until you get a file with
301 a name containing characters with the high bit set. So read_header
302 computes two checksums -- signed and unsigned. */
304 /* FIXME: The signed checksum computation is broken on machines where char's
305 are unsigned. It's uneasy to handle all cases correctly... */
311 long unsigned_sum
; /* the POSIX one :-) */
312 long signed_sum
; /* the Sun one :-( */
314 uintmax_t parsed_sum
;
319 union block
*data_block
;
320 size_t size
, written
;
321 static char *next_long_name
, *next_long_link
;
325 header
= find_next_block ();
326 current_header
= header
;
328 return HEADER_END_OF_FILE
;
330 parsed_sum
= from_oct (header
->header
.chksum
,
331 sizeof header
->header
.chksum
,
332 (char *) 0, TYPE_MAXIMUM (long));
333 if (parsed_sum
== (uintmax_t) -1)
334 return HEADER_FAILURE
;
336 recorded_sum
= parsed_sum
;
340 for (i
= sizeof (*header
); i
-- != 0;)
342 /* We can't use unsigned char here because of old compilers,
345 unsigned_sum
+= 0xFF & *p
;
349 /* Adjust checksum to count the "chksum" field as blanks. */
351 for (i
= sizeof (header
->header
.chksum
); i
-- != 0;)
353 unsigned_sum
-= 0xFF & header
->header
.chksum
[i
];
354 signed_sum
-= header
->header
.chksum
[i
];
356 unsigned_sum
+= ' ' * sizeof header
->header
.chksum
;
357 signed_sum
+= ' ' * sizeof header
->header
.chksum
;
359 if (unsigned_sum
== sizeof header
->header
.chksum
* ' ')
361 /* This is a zeroed block...whole block is 0's except for the
362 blanks we faked for the checksum field. */
364 return HEADER_ZERO_BLOCK
;
367 if (unsigned_sum
!= recorded_sum
&& signed_sum
!= recorded_sum
)
368 return HEADER_FAILURE
;
370 /* Good block. Decode file size and return. */
372 if (header
->header
.typeflag
== LNKTYPE
)
373 current_stat
.st_size
= 0; /* links 0 size on tape */
375 current_stat
.st_size
= OFF_FROM_OCT (header
->header
.size
);
377 header
->header
.name
[NAME_FIELD_SIZE
- 1] = '\0';
378 if (header
->header
.typeflag
== GNUTYPE_LONGNAME
379 || header
->header
.typeflag
== GNUTYPE_LONGLINK
)
381 longp
= ((header
->header
.typeflag
== GNUTYPE_LONGNAME
)
385 set_next_block_after (header
);
388 size
= current_stat
.st_size
;
389 if (size
!= current_stat
.st_size
)
390 FATAL_ERROR ((0, 0, _("Memory exhausted")));
391 bp
= *longp
= (char *) xmalloc (size
);
393 for (; size
> 0; size
-= written
)
395 data_block
= find_next_block ();
396 if (data_block
== NULL
)
398 ERROR ((0, 0, _("Unexpected EOF on archive file")));
401 written
= available_space_after (data_block
);
405 memcpy (bp
, data_block
->buffer
, written
);
407 set_next_block_after ((union block
*)
408 (data_block
->buffer
+ written
- 1));
416 char *name
= next_long_name
;
417 struct posix_header
*h
= ¤t_header
->header
;
418 char namebuf
[sizeof h
->prefix
+ 1 + sizeof h
->name
+ 1];
422 /* Accept file names as specified by POSIX.1-1996
427 memcpy (np
, h
->prefix
, sizeof h
->prefix
);
428 np
[sizeof h
->prefix
] = '\0';
432 memcpy (np
, h
->name
, sizeof h
->name
);
433 np
[sizeof h
->name
] = '\0';
437 assign_string (¤t_file_name
, name
);
438 assign_string (¤t_link_name
,
439 (next_long_link
? next_long_link
440 : current_header
->header
.linkname
));
441 next_long_link
= next_long_name
= 0;
442 return HEADER_SUCCESS
;
447 /*-------------------------------------------------------------------------.
448 | Decode things from a file HEADER block into STAT_INFO, also setting |
449 | *FORMAT_POINTER depending on the header block format. If DO_USER_GROUP, |
450 | decode the user/group information (this is useful for extraction, but |
451 | waste time when merely listing). |
453 | read_header() has already decoded the checksum and length, so we don't. |
455 | This routine should *not* be called twice for the same block, since the |
456 | two calls might use different DO_USER_GROUP values and thus might end up |
457 | with different uid/gid for the two calls. If anybody wants the uid/gid |
458 | they should decode it first, and other callers should decode it without |
459 | uid/gid before calling a routine, e.g. print_header, that assumes |
461 `-------------------------------------------------------------------------*/
464 decode_header (union block
*header
, struct stat
*stat_info
,
465 enum archive_format
*format_pointer
, int do_user_group
)
467 enum archive_format format
;
469 if (strcmp (header
->header
.magic
, TMAGIC
) == 0)
470 format
= POSIX_FORMAT
;
471 else if (strcmp (header
->header
.magic
, OLDGNU_MAGIC
) == 0)
472 format
= OLDGNU_FORMAT
;
475 *format_pointer
= format
;
477 stat_info
->st_mode
= MODE_FROM_OCT (header
->header
.mode
);
478 stat_info
->st_mtime
= TIME_FROM_OCT (header
->header
.mtime
);
480 if (format
== OLDGNU_FORMAT
&& incremental_option
)
482 stat_info
->st_atime
= TIME_FROM_OCT (header
->oldgnu_header
.atime
);
483 stat_info
->st_ctime
= TIME_FROM_OCT (header
->oldgnu_header
.ctime
);
486 if (format
== V7_FORMAT
)
488 stat_info
->st_uid
= UID_FROM_OCT (header
->header
.uid
);
489 stat_info
->st_gid
= GID_FROM_OCT (header
->header
.gid
);
490 stat_info
->st_rdev
= 0;
496 /* FIXME: Decide if this should somewhat depend on -p. */
498 if (numeric_owner_option
499 || !*header
->header
.uname
500 || !uname_to_uid (header
->header
.uname
, &stat_info
->st_uid
))
501 stat_info
->st_uid
= UID_FROM_OCT (header
->header
.uid
);
503 if (numeric_owner_option
504 || !*header
->header
.gname
505 || !gname_to_gid (header
->header
.gname
, &stat_info
->st_gid
))
506 stat_info
->st_gid
= GID_FROM_OCT (header
->header
.gid
);
508 switch (header
->header
.typeflag
)
513 = makedev (MAJOR_FROM_OCT (header
->header
.devmajor
),
514 MINOR_FROM_OCT (header
->header
.devminor
));
521 = makedev (MAJOR_FROM_OCT (header
->header
.devmajor
),
522 MINOR_FROM_OCT (header
->header
.devminor
));
527 stat_info
->st_rdev
= 0;
532 /*------------------------------------------------------------------------.
533 | Quick and dirty octal conversion. Result is -1 if the field is invalid |
534 | (all blank, or nonoctal). |
535 `------------------------------------------------------------------------*/
538 from_oct (const char *where0
, size_t digs0
, const char *type
, uintmax_t maxval
)
541 const char *where
= where0
;
549 ERROR ((0, 0, _("Blanks in header where octal %s value expected"),
553 if (!ISSPACE ((unsigned char) *where
))
560 while (digs
!= 0 && ISODIGIT (*where
))
562 /* Scan til nonoctal. */
564 if (value
<< 3 >> 3 != value
)
566 value
= (value
<< 3) | (*where
++ - '0');
570 if (digs
!= 0 && *where
&& !ISSPACE ((unsigned char) *where
))
574 char buf
[1000]; /* Big enough to represent any header. */
575 static struct quoting_options
*o
;
579 o
= clone_quoting_options ((struct quoting_options
*) 0);
580 set_quoting_style (o
, c_quoting_style
);
583 for (digs
= digs0
; digs
&& ! where0
[digs
- 1]; digs
--)
585 quotearg_buffer (buf
, sizeof buf
, where0
, digs
, o
);
587 _("Header contains %.*s where octal %s value expected"),
588 (int) sizeof buf
, buf
, type
));
599 ERROR ((0, 0, _("Octal value `%.*s' is out of range for %s"),
600 (int) digs0
, where0
, type
));
604 gid_from_oct (const char *p
, size_t s
)
606 return from_oct (p
, s
, "gid_t", (uintmax_t) TYPE_MAXIMUM (gid_t
));
609 major_from_oct (const char *p
, size_t s
)
611 return from_oct (p
, s
, "major_t", (uintmax_t) TYPE_MAXIMUM (major_t
));
614 minor_from_oct (const char *p
, size_t s
)
616 return from_oct (p
, s
, "minor_t", (uintmax_t) TYPE_MAXIMUM (minor_t
));
619 mode_from_oct (const char *p
, size_t s
)
621 /* Do not complain about unrecognized mode bits. */
622 unsigned u
= from_oct (p
, s
, "mode_t", TYPE_MAXIMUM (uintmax_t));
623 return ((u
& TSUID
? S_ISUID
: 0)
624 | (u
& TSGID
? S_ISGID
: 0)
625 | (u
& TSVTX
? S_ISVTX
: 0)
626 | (u
& TUREAD
? S_IRUSR
: 0)
627 | (u
& TUWRITE
? S_IWUSR
: 0)
628 | (u
& TUEXEC
? S_IXUSR
: 0)
629 | (u
& TGREAD
? S_IRGRP
: 0)
630 | (u
& TGWRITE
? S_IWGRP
: 0)
631 | (u
& TGEXEC
? S_IXGRP
: 0)
632 | (u
& TOREAD
? S_IROTH
: 0)
633 | (u
& TOWRITE
? S_IWOTH
: 0)
634 | (u
& TOEXEC
? S_IXOTH
: 0));
637 off_from_oct (const char *p
, size_t s
)
639 return from_oct (p
, s
, "off_t", (uintmax_t) TYPE_MAXIMUM (off_t
));
642 size_from_oct (const char *p
, size_t s
)
644 return from_oct (p
, s
, "size_t", (uintmax_t) TYPE_MAXIMUM (size_t));
647 time_from_oct (const char *p
, size_t s
)
649 return from_oct (p
, s
, "time_t", (uintmax_t) TYPE_MAXIMUM (time_t));
652 uid_from_oct (const char *p
, size_t s
)
654 return from_oct (p
, s
, "uid_t", (uintmax_t) TYPE_MAXIMUM (uid_t
));
657 uintmax_from_oct (const char *p
, size_t s
)
659 return from_oct (p
, s
, "uintmax_t", TYPE_MAXIMUM (uintmax_t));
664 /*----------------------------------------------------------------------.
665 | Format O as a null-terminated decimal string into BUF _backwards_; |
666 | return pointer to start of result. |
667 `----------------------------------------------------------------------*/
669 stringify_uintmax_t_backwards (uintmax_t o
, char *buf
)
673 *--buf
= '0' + (int) (o
% 10);
674 while ((o
/= 10) != 0);
680 /*-------------------------------------------.
681 | Return the time formatted along ISO 8601. |
682 `-------------------------------------------*/
684 /* Also, see http://www.ft.uni-erlangen.de/~mskuhn/iso-time.html. */
687 isotime (const time_t *time
)
689 static char buffer
[21];
692 tm
= localtime (time
);
693 sprintf (buffer
, "%4d-%02d-%02d %02d:%02d:%02d\n",
694 tm
->tm_year
+ 1900, tm
->tm_mon
+ 1, tm
->tm_mday
,
695 tm
->tm_hour
, tm
->tm_min
, tm
->tm_sec
);
699 #endif /* not USE_OLD_CTIME */
701 /*-------------------------------------------------------------------------.
702 | Decode MODE from its binary form in a stat structure, and encode it into |
703 | a 9 characters string STRING, terminated with a NUL. |
704 `-------------------------------------------------------------------------*/
707 decode_mode (mode_t mode
, char *string
)
709 *string
++ = mode
& S_IRUSR
? 'r' : '-';
710 *string
++ = mode
& S_IWUSR
? 'w' : '-';
711 *string
++ = (mode
& S_ISUID
712 ? (mode
& S_IXUSR
? 's' : 'S')
713 : (mode
& S_IXUSR
? 'x' : '-'));
714 *string
++ = mode
& S_IRGRP
? 'r' : '-';
715 *string
++ = mode
& S_IWGRP
? 'w' : '-';
716 *string
++ = (mode
& S_ISGID
717 ? (mode
& S_IXGRP
? 's' : 'S')
718 : (mode
& S_IXGRP
? 'x' : '-'));
719 *string
++ = mode
& S_IROTH
? 'r' : '-';
720 *string
++ = mode
& S_IWOTH
? 'w' : '-';
721 *string
++ = (mode
& S_ISVTX
722 ? (mode
& S_IXOTH
? 't' : 'T')
723 : (mode
& S_IXOTH
? 'x' : '-'));
727 /*-------------------------------------------------------------------------.
728 | Actually print it. |
730 | Plain and fancy file header block logging. Non-verbose just prints the |
731 | name, e.g. for "tar t" or "tar x". This should just contain file names, |
732 | so it can be fed back into tar with xargs or the "-T" option. The |
733 | verbose option can give a bunch of info, one line per file. I doubt |
734 | anybody tries to parse its format, or if they do, they shouldn't. Unix |
735 | tar is pretty random here anyway. |
736 `-------------------------------------------------------------------------*/
738 /* FIXME: Note that print_header uses the globals HEAD, HSTAT, and
739 HEAD_STANDARD, which must be set up in advance. Not very clean... */
741 /* UGSWIDTH starts with 18, so with user and group names <= 8 chars, the
742 columns never shift during the listing. */
744 static int ugswidth
= UGSWIDTH
; /* maximum width encountered so far */
746 /* DATEWIDTH is the number of columns taken by the date and time fields. */
748 # define DATEWIDTH 19
750 # define DATEWIDTH 18
758 /* These hold formatted ints. */
759 char uform
[UINTMAX_STRSIZE_BOUND
], gform
[UINTMAX_STRSIZE_BOUND
];
761 char size
[2 * UINTMAX_STRSIZE_BOUND
];
762 /* holds formatted size or major,minor */
763 char uintbuf
[UINTMAX_STRSIZE_BOUND
];
764 time_t longie
; /* to make ctime() call portable */
768 if (block_number_option
)
770 char buf
[UINTMAX_STRSIZE_BOUND
];
771 fprintf (stdlis
, _("block %s: "),
772 STRINGIFY_BIGINT (current_block_ordinal (), buf
));
775 if (verbose_option
<= 1)
777 /* Just the fax, mam. */
779 char *quoted_name
= quote_copy_string (current_file_name
);
783 fprintf (stdlis
, "%s\n", quoted_name
);
787 fprintf (stdlis
, "%s\n", current_file_name
);
791 /* File type and modes. */
794 switch (current_header
->header
.typeflag
)
800 case GNUTYPE_MULTIVOL
:
808 case GNUTYPE_LONGNAME
:
809 case GNUTYPE_LONGLINK
:
810 ERROR ((0, 0, _("Visible longname error")));
818 if (current_file_name
[strlen (current_file_name
) - 1] == '/')
821 case GNUTYPE_DUMPDIR
:
844 decode_mode (current_stat
.st_mode
, modes
+ 1);
848 longie
= current_stat
.st_mtime
;
850 timestamp
= ctime (&longie
);
851 timestamp
[16] = '\0';
852 timestamp
[24] = '\0';
854 timestamp
= isotime (&longie
);
855 timestamp
[16] = '\0';
858 /* User and group names. */
860 if (*current_header
->header
.uname
&& current_format
!= V7_FORMAT
)
861 user
= current_header
->header
.uname
;
863 user
= STRINGIFY_BIGINT (UINTMAX_FROM_OCT (current_header
->header
.uid
),
866 if (*current_header
->header
.gname
&& current_format
!= V7_FORMAT
)
867 group
= current_header
->header
.gname
;
869 group
= STRINGIFY_BIGINT (UINTMAX_FROM_OCT
870 (current_header
->header
.gid
),
873 /* Format the file size or major/minor device numbers. */
875 switch (current_header
->header
.typeflag
)
877 #if defined S_ISBLK || defined S_ISCHR
880 sprintf (size
, "%lu,%lu",
881 (unsigned long) major (current_stat
.st_rdev
),
882 (unsigned long) minor (current_stat
.st_rdev
));
888 (UINTMAX_FROM_OCT (current_header
->oldgnu_header
.realsize
),
892 strcpy (size
, STRINGIFY_BIGINT (current_stat
.st_size
, uintbuf
));
896 /* Figure out padding and print the whole line. */
898 pad
= strlen (user
) + strlen (group
) + strlen (size
) + 1;
903 fprintf (stdlis
, "%s %s/%s %*s%s %s %s",
904 modes
, user
, group
, ugswidth
- pad
, "",
905 size
, timestamp
+ 4, timestamp
+ 20);
907 fprintf (stdlis
, "%s %s/%s %*s%s %s",
908 modes
, user
, group
, ugswidth
- pad
, "", size
, timestamp
);
911 name
= quote_copy_string (current_file_name
);
914 fprintf (stdlis
, " %s", name
);
918 fprintf (stdlis
, " %s", current_file_name
);
920 switch (current_header
->header
.typeflag
)
923 name
= quote_copy_string (current_link_name
);
926 fprintf (stdlis
, " -> %s\n", name
);
930 fprintf (stdlis
, " -> %s\n", current_link_name
);
934 name
= quote_copy_string (current_link_name
);
937 fprintf (stdlis
, _(" link to %s\n"), name
);
941 fprintf (stdlis
, _(" link to %s\n"), current_link_name
);
945 fprintf (stdlis
, _(" unknown file type `%c'\n"),
946 current_header
->header
.typeflag
);
957 case GNUTYPE_DUMPDIR
:
962 fprintf (stdlis
, _("--Volume Header--\n"));
965 case GNUTYPE_MULTIVOL
:
968 (UINTMAX_FROM_OCT (current_header
->oldgnu_header
.offset
),
970 fprintf (stdlis
, _("--Continued at byte %s--\n"), size
);
974 fprintf (stdlis
, _("--Mangled file names--\n"));
981 /*--------------------------------------------------------------.
982 | Print a similar line when we make a directory automatically. |
983 `--------------------------------------------------------------*/
986 print_for_mkdir (char *pathname
, int length
, mode_t mode
)
991 if (verbose_option
> 1)
993 /* File type and modes. */
996 decode_mode (mode
, modes
+ 1);
998 if (block_number_option
)
1000 char buf
[UINTMAX_STRSIZE_BOUND
];
1001 fprintf (stdlis
, _("block %s: "),
1002 STRINGIFY_BIGINT (current_block_ordinal (), buf
));
1004 name
= quote_copy_string (pathname
);
1007 fprintf (stdlis
, "%s %*s %.*s\n", modes
, ugswidth
+ DATEWIDTH
,
1008 _("Creating directory:"), length
, name
);
1012 fprintf (stdlis
, "%s %*s %.*s\n", modes
, ugswidth
+ DATEWIDTH
,
1013 _("Creating directory:"), length
, pathname
);
1017 /*--------------------------------------------------------.
1018 | Skip over SIZE bytes of data in blocks in the archive. |
1019 `--------------------------------------------------------*/
1022 skip_file (off_t size
)
1026 if (multi_volume_option
)
1028 save_totsize
= size
;
1029 save_sizeleft
= size
;
1034 x
= find_next_block ();
1036 FATAL_ERROR ((0, 0, _("Unexpected EOF on archive file")));
1038 set_next_block_after (x
);
1040 if (multi_volume_option
)
1041 save_sizeleft
-= BLOCKSIZE
;
1050 skip_extended_headers (void)
1056 exhdr
= find_next_block ();
1057 if (!exhdr
->sparse_header
.isextended
)
1059 set_next_block_after (exhdr
);
1062 set_next_block_after (exhdr
);