Sync with NetBSD.

MFC after:	2 weeks
This commit is contained in:
Xin LI 2014-10-23 01:22:29 +00:00
parent e08aa0528f
commit 060ea80ecb
5 changed files with 41 additions and 17 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.16 2011/06/21 13:25:45 joerg Exp $
# $NetBSD: Makefile,v 1.18 2013/11/13 11:12:24 pettai Exp $
# $FreeBSD$
.include <src.opts.mk>
@ -21,7 +21,8 @@ SCRIPTS= gzexe zdiff zforce zmore znew
MLINKS+= gzip.1 gunzip.1 \
gzip.1 gzcat.1 \
gzip.1 zcat.1 \
zdiff.1 zcmp.1
zdiff.1 zcmp.1 \
zmore.1 zless.1
LINKS+= ${BINDIR}/gzip ${BINDIR}/gunzip \
${BINDIR}/gzip ${BINDIR}/gzcat \

View File

@ -1,4 +1,4 @@
.\" $NetBSD: gzip.1,v 1.21 2011/06/19 02:22:36 christos Exp $
.\" $NetBSD: gzip.1,v 1.23 2014/03/18 18:20:45 riastradh Exp $
.\"
.\" Copyright (c) 1997, 2003, 2004 Matthew R. Green
.\" All rights reserved.

View File

@ -1,4 +1,4 @@
/* $NetBSD: gzip.c,v 1.105 2011/08/30 23:06:00 joerg Exp $ */
/* $NetBSD: gzip.c,v 1.106 2014/10/18 08:33:30 snj Exp $ */
/*-
* Copyright (c) 1997, 1998, 2003, 2004, 2006 Matthew R. Green
@ -158,7 +158,7 @@ static suffixes_t suffixes[] = {
#define NUM_SUFFIXES (sizeof suffixes / sizeof suffixes[0])
#define SUFFIX_MAXLEN 30
static const char gzip_version[] = "FreeBSD gzip 20111009";
static const char gzip_version[] = "FreeBSD gzip 20141022";
#ifndef SMALL
static const char gzip_copyright[] = \
@ -1769,7 +1769,7 @@ handle_stdout(void)
return;
}
#endif
/* If stdin is a file use it's mtime, otherwise use current time */
/* If stdin is a file use its mtime, otherwise use current time */
ret = fstat(STDIN_FILENO, &sb);
#ifndef SMALL
@ -2110,7 +2110,7 @@ static void
display_license(void)
{
fprintf(stderr, "%s (based on NetBSD gzip 20111009)\n", gzip_version);
fprintf(stderr, "%s (based on NetBSD gzip 20141018)\n", gzip_version);
fprintf(stderr, "%s\n", gzip_copyright);
exit(0);
}

View File

@ -1,7 +1,8 @@
#!/bin/sh -
#
# $NetBSD: zmore,v 1.3 2004/03/29 09:59:42 wiz Exp $
# $OpenBSD: zmore,v 1.4 2003/07/29 07:42:45 otto Exp $
# $NetBSD: zmore,v 1.5 2013/12/06 13:33:15 pettai Exp $
#
# $OpenBSD: zmore,v 1.6 2008/08/20 09:22:02 mpf Exp $
#
#-
# Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
@ -42,15 +43,21 @@ while test $# -ne 0; do
esac
done
if [ `basename $0` = "zless" ] ; then
pager=${PAGER-less}
else
pager=${PAGER-more}
fi
# No files means read from stdin
if [ $# -eq 0 ]; then
gzip -cdfq 2>&1 | ${PAGER-more} $flags
gzip -cdfq 2>&1 | $pager $flags
exit 0
fi
oterm=`stty -g 2>/dev/null`
while test $# -ne 0; do
gzip -cdfq "$1" 2>&1 | ${PAGER-more} $flags
gzip -cdfq "$1" 2>&1 | $pager $flags
prev="$1"
shift
if tty -s && test -n "$oterm" -a $# -gt 0; then

View File

@ -1,5 +1,5 @@
.\" $NetBSD: zmore.1,v 1.3 2003/12/28 12:47:52 wiz Exp $
.\" $OpenBSD: zmore.1,v 1.3 2003/06/23 21:00:48 deraadt Exp $
.\" $NetBSD: zmore.1,v 1.4 2013/11/12 21:58:37 pettai Exp $
.\" $OpenBSD: zmore.1,v 1.10 2009/08/16 09:41:08 sobrado Exp $
.\"
.\" Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com>
.\"
@ -20,16 +20,20 @@
.\" Materiel Command, USAF, under agreement number F39502-99-1-0512.
.\"
.\" $FreeBSD$
.Dd February 6, 2011
.Dd October 22, 2014
.Dt ZMORE 1
.Os
.Sh NAME
.Nm zmore
.Nm zmore ,
.Nm zless
.Nd view compressed files
.Sh SYNOPSIS
.Nm zmore
.Op Ar flags
.Op Ar file ...
.Op Ar
.Nm zless
.Op Ar flags
.Op Ar
.Sh DESCRIPTION
.Nm
is a filter that allows the viewing of files compressed with Lempel-Ziv
@ -51,6 +55,14 @@ that are specified are passed to the user's preferred
.Pa /usr/bin/more
by default).
.Pp
.Nm zless
is equivalent to
.Nm zmore
but uses
.Xr less 1
as a pager instead of
.Xr more 1 .
.Pp
When multiple files are specified,
.Nm
will pause at the end of each file and present the following prompt to the user:
@ -86,7 +98,11 @@ style compression since there is no suffix on which to make a decision.
Program used to display files.
If unset,
.Pa /usr/bin/more
is used.
is used
.Pq Nm zmore
or
.Pa /usr/bin/less
.Pq Nm zless .
.El
.Sh SEE ALSO
.Xr compress 1 ,