2006-07-02 19:47:05 +00:00
|
|
|
/* vi: set sw=4 ts=4: */
|
2006-07-12 07:56:04 +00:00
|
|
|
/*
|
2010-08-16 18:14:46 +00:00
|
|
|
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
|
2006-07-12 07:56:04 +00:00
|
|
|
*/
|
|
|
|
|
2002-09-25 02:47:48 +00:00
|
|
|
#include "libbb.h"
|
2010-11-03 01:38:31 +00:00
|
|
|
#include "archive.h"
|
2002-09-25 02:47:48 +00:00
|
|
|
|
2008-06-27 02:52:20 +00:00
|
|
|
void FAST_FUNC header_verbose_list(const file_header_t *file_header)
|
2002-09-25 02:47:48 +00:00
|
|
|
{
|
2010-01-09 18:10:49 +00:00
|
|
|
struct tm tm_time;
|
|
|
|
struct tm *ptm = &tm_time; //localtime(&file_header->mtime);
|
2002-09-25 02:47:48 +00:00
|
|
|
|
2008-02-14 20:37:54 +00:00
|
|
|
#if ENABLE_FEATURE_TAR_UNAME_GNAME
|
2010-01-06 08:43:11 +00:00
|
|
|
char uid[sizeof(int)*3 + 2];
|
|
|
|
/*char gid[sizeof(int)*3 + 2];*/
|
|
|
|
char *user;
|
|
|
|
char *group;
|
2008-02-14 20:37:54 +00:00
|
|
|
|
2010-01-09 18:10:49 +00:00
|
|
|
localtime_r(&file_header->mtime, ptm);
|
|
|
|
|
2010-01-06 09:53:17 +00:00
|
|
|
user = file_header->tar__uname;
|
2008-02-14 20:37:54 +00:00
|
|
|
if (user == NULL) {
|
2010-01-06 08:43:11 +00:00
|
|
|
sprintf(uid, "%u", (unsigned)file_header->uid);
|
2008-02-14 20:37:54 +00:00
|
|
|
user = uid;
|
|
|
|
}
|
2010-01-06 09:53:17 +00:00
|
|
|
group = file_header->tar__gname;
|
2008-02-14 20:37:54 +00:00
|
|
|
if (group == NULL) {
|
2010-01-06 08:43:11 +00:00
|
|
|
/*sprintf(gid, "%u", (unsigned)file_header->gid);*/
|
|
|
|
group = utoa(file_header->gid);
|
2008-02-14 20:37:54 +00:00
|
|
|
}
|
2008-12-12 02:14:35 +00:00
|
|
|
printf("%s %s/%s %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
|
2008-02-14 20:37:54 +00:00
|
|
|
bb_mode_string(file_header->mode),
|
|
|
|
user,
|
|
|
|
group,
|
2008-12-12 02:14:35 +00:00
|
|
|
file_header->size,
|
2010-01-09 18:10:49 +00:00
|
|
|
1900 + ptm->tm_year,
|
|
|
|
1 + ptm->tm_mon,
|
|
|
|
ptm->tm_mday,
|
|
|
|
ptm->tm_hour,
|
|
|
|
ptm->tm_min,
|
|
|
|
ptm->tm_sec,
|
2008-02-14 20:37:54 +00:00
|
|
|
file_header->name);
|
2010-01-09 18:10:49 +00:00
|
|
|
|
2008-02-14 20:37:54 +00:00
|
|
|
#else /* !FEATURE_TAR_UNAME_GNAME */
|
2010-01-09 18:10:49 +00:00
|
|
|
|
|
|
|
localtime_r(&file_header->mtime, ptm);
|
|
|
|
|
2010-01-06 08:43:11 +00:00
|
|
|
printf("%s %u/%u %9"OFF_FMT"u %4u-%02u-%02u %02u:%02u:%02u %s",
|
2003-03-19 09:13:01 +00:00
|
|
|
bb_mode_string(file_header->mode),
|
2010-01-06 08:43:11 +00:00
|
|
|
(unsigned)file_header->uid,
|
|
|
|
(unsigned)file_header->gid,
|
2006-11-24 14:53:18 +00:00
|
|
|
file_header->size,
|
2010-01-09 18:10:49 +00:00
|
|
|
1900 + ptm->tm_year,
|
|
|
|
1 + ptm->tm_mon,
|
|
|
|
ptm->tm_mday,
|
|
|
|
ptm->tm_hour,
|
|
|
|
ptm->tm_min,
|
|
|
|
ptm->tm_sec,
|
2002-09-25 02:47:48 +00:00
|
|
|
file_header->name);
|
2010-01-09 18:10:49 +00:00
|
|
|
|
2008-02-14 20:37:54 +00:00
|
|
|
#endif /* FEATURE_TAR_UNAME_GNAME */
|
2002-09-25 02:47:48 +00:00
|
|
|
|
2010-04-09 12:11:45 +00:00
|
|
|
/* NB: GNU tar shows "->" for symlinks and "link to" for hardlinks */
|
2007-06-20 14:49:47 +00:00
|
|
|
if (file_header->link_target) {
|
|
|
|
printf(" -> %s", file_header->link_target);
|
2002-09-25 02:47:48 +00:00
|
|
|
}
|
2007-09-27 10:20:47 +00:00
|
|
|
bb_putchar('\n');
|
2002-09-25 02:47:48 +00:00
|
|
|
}
|