/* List a tar archive, with support routines for reading a tar archive.
- Copyright 1988, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000,
- 2001 Free Software Foundation, Inc.
+ Copyright (C) 1988, 1992, 1993, 1994, 1996, 1997, 1998, 1999, 2000,
+ 2001, 2003 Free Software Foundation, Inc.
Written by John Gilmore, on 1985-08-26.
size_t recent_long_name_blocks; /* number of blocks in recent_long_name */
size_t recent_long_link_blocks; /* likewise, for long link */
-static uintmax_t from_header PARAMS ((const char *, size_t, const char *,
- uintmax_t, uintmax_t));
+static uintmax_t from_header (const char *, size_t, const char *,
+ uintmax_t, uintmax_t);
/* Base 64 digits; see Internet RFC 2045 Table 1. */
static char const base_64_digits[64] =
/* Main loop for reading an archive. */
void
-read_and (void (*do_something) ())
+read_and (void (*do_something) (void))
{
enum read_header status = HEADER_STILL_UNREAD;
enum read_header prev_status;
case GNUTYPE_MULTIVOL:
case GNUTYPE_NAMES:
break;
-
+
case DIRTYPE:
if (show_omitted_dirs_option)
WARN ((0, 0, _("%s: Omitting"),
{
if (verbose_option > 1)
decode_header (current_header, ¤t_stat, ¤t_format, 0);
- print_header ();
+ print_header (-1);
}
if (incremental_option && current_header->header.typeflag == GNUTYPE_DUMPDIR)
recent_long_name_blocks = 0;
}
assign_string (¤t_file_name, name);
+ current_trailing_slash = strip_trailing_slashes (current_file_name);
if (recent_long_link)
free (recent_long_link);
size_t
size_from_header (const char *p, size_t s)
{
- return from_header (p, s, "size_t", (uintmax_t) 0,
+ return from_header (p, s, "size_t", (uintmax_t) 0,
(uintmax_t) TYPE_MAXIMUM (size_t));
}
struct tm *tm = localtime (&t);
if (tm)
{
- sprintf (buffer, "%04d-%02d-%02d %02d:%02d:%02d",
- tm->tm_year + 1900, tm->tm_mon + 1, tm->tm_mday,
+ sprintf (buffer, "%04ld-%02d-%02d %02d:%02d:%02d",
+ tm->tm_year + 1900L, tm->tm_mon + 1, tm->tm_mday,
tm->tm_hour, tm->tm_min, tm->tm_sec);
return buffer;
}
#endif
void
-print_header (void)
+print_header (off_t block_ordinal)
{
char modes[11];
char const *time_stamp;
if (block_number_option)
{
char buf[UINTMAX_STRSIZE_BOUND];
+ if (block_ordinal < 0)
+ block_ordinal = current_block_ordinal ();
+ block_ordinal -= recent_long_name_blocks;
+ block_ordinal -= recent_long_link_blocks;
fprintf (stdlis, _("block %s: "),
- STRINGIFY_BIGINT (current_block_ordinal (), buf));
+ STRINGIFY_BIGINT (block_ordinal, buf));
}
if (verbose_option <= 1)
case GNUTYPE_LONGNAME:
case GNUTYPE_LONGLINK:
+ modes[0] = 'L';
ERROR ((0, 0, _("Visible longname error")));
break;
case GNUTYPE_SPARSE:
case REGTYPE:
case AREGTYPE:
- case LNKTYPE:
modes[0] = '-';
if (current_file_name[strlen (current_file_name) - 1] == '/')
modes[0] = 'd';
break;
+ case LNKTYPE:
+ modes[0] = 'h';
+ break;
case GNUTYPE_DUMPDIR:
modes[0] = 'd';
break;
putc ('\n', stdlis);
break;
+ case GNUTYPE_LONGLINK:
+ fprintf (stdlis, _("--Long Link--\n"));
+ break;
+
+ case GNUTYPE_LONGNAME:
+ fprintf (stdlis, _("--Long Name--\n"));
+ break;
+
case GNUTYPE_VOLHDR:
fprintf (stdlis, _("--Volume Header--\n"));
break;