summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2014-01-23 18:04:36 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2014-01-23 18:04:36 +0200
commita09e840507c16357ec11b17a02e103c3a26adebc (patch)
tree00a09a46ab09566ff790e4834c05a2082b8dd154
parenteb7e2aa9334d80747c6f6c4f093716fd030f3f15 (diff)
downloadtar-a09e840507c16357ec11b17a02e103c3a26adebc.tar.gz
Make sure transformed file names retain trailing slash in listing.
* src/list.c (simple_print_header): Print trailing slash if using the transformed name. Use had_trailing_slash instead of analyzing last byte if temp_name
-rw-r--r--src/list.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/list.c b/src/list.c
index 094f6490..3a59f299 100644
--- a/src/list.c
+++ b/src/list.c
@@ -1111,7 +1111,10 @@ simple_print_header (struct tar_stat_info *st, union block *blk,
if (verbose_option <= 1)
{
/* Just the fax, mam. */
- fprintf (stdlis, "%s\n", quotearg (temp_name));
+ fputs (quotearg (temp_name), stdlis);
+ if (show_transformed_names_option && st->had_trailing_slash)
+ fputc ('/', stdlis);
+ fputc ('\n', stdlis);
}
else
{
@@ -1138,9 +1141,7 @@ simple_print_header (struct tar_stat_info *st, union block *blk,
case GNUTYPE_SPARSE:
case REGTYPE:
case AREGTYPE:
- modes[0] = '-';
- if (temp_name[strlen (temp_name) - 1] == '/')
- modes[0] = 'd';
+ modes[0] = st->had_trailing_slash ? 'd' : '-';
break;
case LNKTYPE:
modes[0] = 'h';
@@ -1251,6 +1252,8 @@ simple_print_header (struct tar_stat_info *st, union block *blk,
datewidth, time_stamp);
fprintf (stdlis, " %s", quotearg (temp_name));
+ if (show_transformed_names_option && st->had_trailing_slash)
+ fputc ('/', stdlis);
switch (blk->header.typeflag)
{