source: branches/3.2/mindi-busybox/archival/libarchive/header_verbose_list.c @ 3232

Last change on this file since 3232 was 3232, checked in by Bruno Cornec, 6 years ago
  • Update mindi-busybox to 1.21.1
  • Property svn:eol-style set to native
File size: 1.6 KB
Line 
1/* vi: set sw=4 ts=4: */
2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */
5
6#include "libbb.h"
7#include "bb_archive.h"
8
9void FAST_FUNC header_verbose_list(const file_header_t *file_header)
10{
11    struct tm tm_time;
12    struct tm *ptm = &tm_time; //localtime(&file_header->mtime);
13
14#if ENABLE_FEATURE_TAR_UNAME_GNAME
15    char uid[sizeof(int)*3 + 2];
16    /*char gid[sizeof(int)*3 + 2];*/
17    char *user;
18    char *group;
19
20    localtime_r(&file_header->mtime, ptm);
21
22    user = file_header->tar__uname;
23    if (user == NULL) {
24        sprintf(uid, "%u", (unsigned)file_header->uid);
25        user = uid;
26    }
27    group = file_header->tar__gname;
28    if (group == NULL) {
29        /*sprintf(gid, "%u", (unsigned)file_header->gid);*/
30        group = utoa(file_header->gid);
31    }
32    printf("%s %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
33        bb_mode_string(file_header->mode),
34        user,
35        group,
36        file_header->size,
37        1900 + ptm->tm_year,
38        1 + ptm->tm_mon,
39        ptm->tm_mday,
40        ptm->tm_hour,
41        ptm->tm_min,
42        ptm->tm_sec,
43        file_header->name);
44
45#else /* !FEATURE_TAR_UNAME_GNAME */
46
47    localtime_r(&file_header->mtime, ptm);
48
49    printf("%s %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
50        bb_mode_string(file_header->mode),
51        (unsigned)file_header->uid,
52        (unsigned)file_header->gid,
53        file_header->size,
54        1900 + ptm->tm_year,
55        1 + ptm->tm_mon,
56        ptm->tm_mday,
57        ptm->tm_hour,
58        ptm->tm_min,
59        ptm->tm_sec,
60        file_header->name);
61
62#endif /* FEATURE_TAR_UNAME_GNAME */
63
64    /* NB: GNU tar shows "->" for symlinks and "link to" for hardlinks */
65    if (file_header->link_target) {
66        printf(" -> %s", file_header->link_target);
67    }
68    bb_putchar('\n');
69}
Note: See TracBrowser for help on using the repository browser.