6 |
#include "libbb.h" |
#include "libbb.h" |
7 |
#include "unarchive.h" |
#include "unarchive.h" |
8 |
|
|
9 |
void header_verbose_list(const file_header_t *file_header) |
void FAST_FUNC header_verbose_list(const file_header_t *file_header) |
10 |
{ |
{ |
11 |
struct tm *mtime = localtime(&(file_header->mtime)); |
struct tm *mtime = localtime(&(file_header->mtime)); |
12 |
|
|
13 |
|
#if ENABLE_FEATURE_TAR_UNAME_GNAME |
14 |
|
char uid[8]; |
15 |
|
char gid[8]; |
16 |
|
char *user = file_header->uname; |
17 |
|
char *group = file_header->gname; |
18 |
|
|
19 |
|
if (user == NULL) { |
20 |
|
snprintf(uid, sizeof(uid), "%u", (unsigned)file_header->uid); |
21 |
|
user = uid; |
22 |
|
} |
23 |
|
if (group == NULL) { |
24 |
|
snprintf(gid, sizeof(gid), "%u", (unsigned)file_header->gid); |
25 |
|
group = gid; |
26 |
|
} |
27 |
|
printf("%s %s/%s %9u %4u-%02u-%02u %02u:%02u:%02u %s", |
28 |
|
bb_mode_string(file_header->mode), |
29 |
|
user, |
30 |
|
group, |
31 |
|
(unsigned int) file_header->size, |
32 |
|
1900 + mtime->tm_year, |
33 |
|
1 + mtime->tm_mon, |
34 |
|
mtime->tm_mday, |
35 |
|
mtime->tm_hour, |
36 |
|
mtime->tm_min, |
37 |
|
mtime->tm_sec, |
38 |
|
file_header->name); |
39 |
|
#else /* !FEATURE_TAR_UNAME_GNAME */ |
40 |
printf("%s %d/%d %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s", |
printf("%s %d/%d %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s", |
41 |
bb_mode_string(file_header->mode), |
bb_mode_string(file_header->mode), |
42 |
file_header->uid, |
file_header->uid, |
49 |
mtime->tm_min, |
mtime->tm_min, |
50 |
mtime->tm_sec, |
mtime->tm_sec, |
51 |
file_header->name); |
file_header->name); |
52 |
|
#endif /* FEATURE_TAR_UNAME_GNAME */ |
53 |
|
|
54 |
if (file_header->link_name) { |
if (file_header->link_target) { |
55 |
printf(" -> %s", file_header->link_name); |
printf(" -> %s", file_header->link_target); |
56 |
} |
} |
57 |
/* putchar isnt used anywhere else i dont think */ |
bb_putchar('\n'); |
|
puts(""); |
|
58 |
} |
} |