Deleted Added
sdiff udiff text old ( 315433 ) new ( 358090 )
full compact
1/*-
2 * Copyright (c) 2003-2007 Tim Kientzle
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

--- 10 unchanged lines hidden (view full) ---

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "bsdtar_platform.h"
27__FBSDID("$FreeBSD: stable/10/contrib/libarchive/tar/util.c 315433 2017-03-16 23:08:18Z mm $");
28
29#ifdef HAVE_SYS_STAT_H
30#include <sys/stat.h>
31#endif
32#ifdef HAVE_SYS_TYPES_H
33#include <sys/types.h> /* Linux doesn't define mode_t, etc. in sys/stat.h. */
34#endif
35#include <ctype.h>

--- 625 unchanged lines hidden (view full) ---

661list_item_verbose(struct bsdtar *bsdtar, FILE *out, struct archive_entry *entry)
662{
663 char tmp[100];
664 size_t w;
665 const char *p;
666 const char *fmt;
667 time_t tim;
668 static time_t now;
669
670 /*
671 * We avoid collecting the entire list in memory at once by
672 * listing things as we see them. However, that also means we can't
673 * just pre-compute the field widths. Instead, we start with guesses
674 * and just widen them as necessary. These numbers are completely
675 * arbitrary.
676 */

--- 55 unchanged lines hidden (view full) ---

732#define DAY_FMT "%d" /* Windows' strftime function does not support %e format. */
733#else
734#define DAY_FMT "%e" /* Day number without leading zeros */
735#endif
736 if (tim < now - HALF_YEAR || tim > now + HALF_YEAR)
737 fmt = bsdtar->day_first ? DAY_FMT " %b %Y" : "%b " DAY_FMT " %Y";
738 else
739 fmt = bsdtar->day_first ? DAY_FMT " %b %H:%M" : "%b " DAY_FMT " %H:%M";
740 strftime(tmp, sizeof(tmp), fmt, localtime(&tim));
741 fprintf(out, " %s ", tmp);
742 safe_fprintf(out, "%s", archive_entry_pathname(entry));
743
744 /* Extra information for links. */
745 if (archive_entry_hardlink(entry)) /* Hard link */
746 safe_fprintf(out, " link to %s",
747 archive_entry_hardlink(entry));
748 else if (archive_entry_symlink(entry)) /* Symbolic link */
749 safe_fprintf(out, " -> %s", archive_entry_symlink(entry));
750}