(print_header): Revised

This commit is contained in:
Sergey Poznyakoff
2003-07-25 15:05:41 +00:00
parent 5a73638d27
commit 7219c538eb

View File

@@ -903,6 +903,8 @@ print_header (off_t block_ordinal)
{ {
char modes[11]; char modes[11];
char const *time_stamp; char const *time_stamp;
char *temp_name;
/* These hold formatted ints. */ /* These hold formatted ints. */
char uform[UINTMAX_STRSIZE_BOUND], gform[UINTMAX_STRSIZE_BOUND]; char uform[UINTMAX_STRSIZE_BOUND], gform[UINTMAX_STRSIZE_BOUND];
char *user, *group; char *user, *group;
@@ -922,13 +924,22 @@ print_header (off_t block_ordinal)
STRINGIFY_BIGINT (block_ordinal, buf)); STRINGIFY_BIGINT (block_ordinal, buf));
} }
if (current_trailing_slash)
{
temp_name = xmalloc (strlen (current_file_name) + 2);
strcpy (temp_name, current_file_name);
strcat (temp_name, "/");
}
else
{
temp_name = xmalloc (strlen (current_file_name) + 1);
strcpy (temp_name, current_file_name);
}
if (verbose_option <= 1) if (verbose_option <= 1)
{ {
/* Just the fax, mam. */ /* Just the fax, mam. */
fprintf (stdlis, "%s", quotearg (current_file_name)); fprintf (stdlis, "%s\n", quotearg (temp_name));
if (current_trailing_slash)
fprintf (stdlis, "/");
fprintf (stdlis, "\n");
} }
else else
{ {
@@ -959,7 +970,7 @@ print_header (off_t block_ordinal)
case REGTYPE: case REGTYPE:
case AREGTYPE: case AREGTYPE:
modes[0] = '-'; modes[0] = '-';
if (current_file_name[strlen (current_file_name) - 1] == '/') if (temp_name[strlen (temp_name) - 1] == '/')
modes[0] = 'd'; modes[0] = 'd';
break; break;
case LNKTYPE: case LNKTYPE:
@@ -1073,7 +1084,7 @@ print_header (off_t block_ordinal)
fprintf (stdlis, "%s %s/%s %*s%s %s", fprintf (stdlis, "%s %s/%s %*s%s %s",
modes, user, group, ugswidth - pad, "", size, time_stamp); modes, user, group, ugswidth - pad, "", size, time_stamp);
fprintf (stdlis, " %s", quotearg (current_file_name)); fprintf (stdlis, " %s", quotearg (temp_name));
switch (current_header->header.typeflag) switch (current_header->header.typeflag)
{ {
@@ -1132,6 +1143,7 @@ print_header (off_t block_ordinal)
break; break;
} }
} }
free (temp_name);
fflush (stdlis); fflush (stdlis);
} }