add ext4,vfat and tar.bz2
[u-tools.git] / u-tools / apps / busybox / archival / libunarchive / header_verbose_list.c
blobf059dd9818bfc943d93bed18e737e7b611cc64bd
1 /* vi: set sw=4 ts=4: */
2 /*
3 * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
4 */
6 #include "libbb.h"
7 #include "unarchive.h"
9 void FAST_FUNC header_verbose_list(const file_header_t *file_header)
11 struct tm *mtime = localtime(&(file_header->mtime));
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;
19 if (user == NULL) {
20 snprintf(uid, sizeof(uid), "%u", (unsigned)file_header->uid);
21 user = uid;
23 if (group == NULL) {
24 snprintf(gid, sizeof(gid), "%u", (unsigned)file_header->gid);
25 group = gid;
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",
41 bb_mode_string(file_header->mode),
42 file_header->uid,
43 file_header->gid,
44 file_header->size,
45 1900 + mtime->tm_year,
46 1 + mtime->tm_mon,
47 mtime->tm_mday,
48 mtime->tm_hour,
49 mtime->tm_min,
50 mtime->tm_sec,
51 file_header->name);
52 #endif /* FEATURE_TAR_UNAME_GNAME */
54 if (file_header->link_target) {
55 printf(" -> %s", file_header->link_target);
57 bb_putchar('\n');