#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef MAJOR_IN_MKDEV
-#include <sys/mkdev.h>
-#elif defined(MAJOR_IN_SYSMACROS)
-#include <sys/sysmacros.h>
-#endif
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
static void
list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
{
- const struct stat *st;
char tmp[100];
size_t w;
const char *p;
time_t tim;
static time_t now;
- st = archive_entry_stat(entry);
-
/*
* We avoid collecting the entire list in memory at once by
* listing things as we see them. However, that also means we can't
time(&now);
fprintf(out, "%s %d ",
archive_entry_strmode(entry),
- (int)(st->st_nlink));
+ archive_entry_nlink(entry));
/* Use uname if it's present, else uid. */
p = archive_entry_uname(entry);
if ((p == NULL) || (*p == '\0')) {
- sprintf(tmp, "%lu ", (unsigned long)st->st_uid);
+ sprintf(tmp, "%lu ",
+ (unsigned long)archive_entry_uid(entry));
p = tmp;
}
w = strlen(p);
fprintf(out, "%s", p);
w = strlen(p);
} else {
- sprintf(tmp, "%lu", (unsigned long)st->st_gid);
+ sprintf(tmp, "%lu",
+ (unsigned long)archive_entry_gid(entry));
w = strlen(tmp);
fprintf(out, "%s", tmp);
}
if (archive_entry_filetype(entry) == AE_IFCHR
|| archive_entry_filetype(entry) == AE_IFBLK) {
sprintf(tmp, "%lu,%lu",
- (unsigned long)major(st->st_rdev),
- (unsigned long)minor(st->st_rdev)); /* ls(1) also casts here. */
+ (unsigned long)archive_entry_rdevmajor(entry),
+ (unsigned long)archive_entry_rdevminor(entry));
} else {
/*
* Note the use of platform-dependent macros to format
* corresponding type for the cast.
*/
sprintf(tmp, BSDTAR_FILESIZE_PRINTF,
- (BSDTAR_FILESIZE_TYPE)st->st_size);
+ (BSDTAR_FILESIZE_TYPE)archive_entry_size(entry));
}
if (w + strlen(tmp) >= bsdtar->gs_width)
bsdtar->gs_width = w+strlen(tmp)+1;
fprintf(out, "%*s", (int)(bsdtar->gs_width - w), tmp);
/* Format the time using 'ls -l' conventions. */
- tim = (time_t)st->st_mtime;
+ tim = archive_entry_mtime(entry);
#if defined(_WIN32) && !defined(__CYGWIN__)
/* Windows' strftime function does not support %e format. */
if (abs(tim - now) > (365/2)*86400)