Update to 5.7.

Stop using <tzfile.h>.  Based on ls(1), so apply the same changes here.
This commit is contained in:
naddy 2015-03-16 14:17:48 +00:00
parent 6164611aa0
commit f9115b7fea
3 changed files with 29 additions and 17 deletions

View File

@ -1,11 +1,10 @@
# $OpenBSD: Makefile,v 1.29 2015/01/30 16:46:46 naddy Exp $
# $OpenBSD: Makefile,v 1.30 2015/03/16 14:17:48 naddy Exp $
COMMENT= ls that can use color to display file attributes
VERSION= 5.6
VERSION= 5.7
DISTNAME= ls-${VERSION}
PKGNAME= colorls-${VERSION}
REVISION= 0
CATEGORIES= sysutils
MAINTAINER= Christian Weisgerber <naddy@openbsd.org>

View File

@ -1,2 +1,2 @@
SHA256 (ls-5.6.tar.gz) = t4Y1hFdYmOT9u5HsUZtud1XxmojwhhYO+StA/1Va7Uc=
SIZE (ls-5.6.tar.gz) = 12770
SHA256 (ls-5.7.tar.gz) = QcaZe1qiopv2HUm4eDlXjKxgWPVOOXUm3EyrCUJU5YI=
SIZE (ls-5.7.tar.gz) = 12759

View File

@ -1,9 +1,19 @@
$OpenBSD: patch-print_c,v 1.11 2014/11/29 19:16:48 naddy Exp $
--- print.c.orig Tue May 6 22:55:10 2014
+++ print.c Sat Nov 29 20:07:39 2014
@@ -48,6 +48,11 @@
#include <tzfile.h>
$OpenBSD: patch-print_c,v 1.12 2015/03/16 14:17:48 naddy Exp $
--- print.c.orig Fri Jan 16 07:39:32 2015
+++ print.c Mon Mar 16 15:15:47 2015
@@ -1,4 +1,4 @@
-/* $OpenBSD: patch-print_c,v 1.12 2015/03/16 14:17:48 naddy Exp $ */
+/* $OpenBSD: patch-print_c,v 1.12 2015/03/16 14:17:48 naddy Exp $ */
/* $NetBSD: print.c,v 1.15 1996/12/11 03:25:39 thorpej Exp $ */
/*
@@ -45,10 +45,14 @@
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#include <tzfile.h>
#include <unistd.h>
#include <limits.h>
#include <util.h>
+#ifdef COLORLS
+#include <ctype.h>
@ -13,7 +23,7 @@ $OpenBSD: patch-print_c,v 1.11 2014/11/29 19:16:48 naddy Exp $
#include "ls.h"
#include "extern.h"
@@ -58,12 +63,42 @@ static void printsize(size_t, off_t);
@@ -59,12 +63,44 @@ static void printsize(size_t, off_t);
static void printtime(time_t);
static int printtype(u_int);
static int compute_columns(DISPLAY *, int *);
@ -25,8 +35,11 @@ $OpenBSD: patch-print_c,v 1.11 2014/11/29 19:16:48 naddy Exp $
#define IS_NOPRINT(p) ((p)->fts_number == NO_PRINT)
#define DATELEN 64
#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
-#define SIXMONTHS ((DAYSPERNYEAR / 2) * SECSPERDAY)
+#define SECSPERDAY (24 * 60 * 60)
+#define SIXMONTHS (SECSPERDAY * 365 / 2)
+
+#ifdef COLORLS
+/* Most of these are taken from <sys/stat.h> */
+typedef enum Colors {
@ -56,7 +69,7 @@ $OpenBSD: patch-print_c,v 1.11 2014/11/29 19:16:48 naddy Exp $
void
printscol(DISPLAY *dp)
{
@@ -84,6 +119,9 @@ printlong(DISPLAY *dp)
@@ -85,6 +121,9 @@ printlong(DISPLAY *dp)
FTSENT *p;
NAMES *np;
char buf[20];
@ -66,7 +79,7 @@ $OpenBSD: patch-print_c,v 1.11 2014/11/29 19:16:48 naddy Exp $
if (dp->list->fts_level != FTS_ROOTLEVEL && (f_longform || f_size))
(void)printf("total %llu\n", howmany(dp->btotal, blocksize));
@@ -120,7 +158,15 @@ printlong(DISPLAY *dp)
@@ -121,7 +160,15 @@ printlong(DISPLAY *dp)
printtime(sp->st_ctime);
else
printtime(sp->st_mtime);
@ -82,7 +95,7 @@ $OpenBSD: patch-print_c,v 1.11 2014/11/29 19:16:48 naddy Exp $
if (f_type || (f_typedir && S_ISDIR(sp->st_mode)))
(void)printtype(sp->st_mode);
if (S_ISLNK(sp->st_mode))
@@ -220,6 +266,9 @@ printaname(FTSENT *p, u_long inodefield, u_long sizefi
@@ -221,6 +268,9 @@ printaname(FTSENT *p, u_long inodefield, u_long sizefi
{
struct stat *sp;
int chcnt;
@ -92,7 +105,7 @@ $OpenBSD: patch-print_c,v 1.11 2014/11/29 19:16:48 naddy Exp $
sp = p->fts_statp;
chcnt = 0;
@@ -229,7 +278,15 @@ printaname(FTSENT *p, u_long inodefield, u_long sizefi
@@ -230,7 +280,15 @@ printaname(FTSENT *p, u_long inodefield, u_long sizefi
if (f_size)
chcnt += printf("%*qd ",
(int)sizefield, howmany(sp->st_blocks, blocksize));
@ -108,7 +121,7 @@ $OpenBSD: patch-print_c,v 1.11 2014/11/29 19:16:48 naddy Exp $
if (f_type || (f_typedir && S_ISDIR(sp->st_mode)))
chcnt += printtype(sp->st_mode);
return (chcnt);
@@ -341,6 +398,151 @@ printtype(u_int mode)
@@ -342,6 +400,151 @@ printtype(u_int mode)
}
return (0);
}