diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-05-20 00:27:28 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2007-05-20 00:27:28 +0000 |
commit | e368a7bf45c060b9b6d89d23467edd46afc11ad6 (patch) | |
tree | 31d038ce924f81b20c7323dd9d7b4f4579c2d3d4 /usr.bin | |
parent | f05ef9675de409cace5814f543af1ef1467f8375 (diff) |
Add support for zmore being called as zless,
same behaviour but pager defaults to less instead of more.
Incorporating feedback from millert@ and jmc@
ok millert@ simon@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/compress/Makefile | 6 | ||||
-rw-r--r-- | usr.bin/compress/zmore | 12 | ||||
-rw-r--r-- | usr.bin/compress/zmore.1 | 22 |
3 files changed, 32 insertions, 8 deletions
diff --git a/usr.bin/compress/Makefile b/usr.bin/compress/Makefile index d05f2c67c65..fe9cf219257 100644 --- a/usr.bin/compress/Makefile +++ b/usr.bin/compress/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.20 2007/01/24 10:53:43 jmc Exp $ +# $OpenBSD: Makefile,v 1.21 2007/05/20 00:27:27 jsg Exp $ PROG= compress SRCS= main.c zopen.c gzopen.c nullopen.c @@ -8,11 +8,13 @@ LINKS= ${BINDIR}/compress ${BINDIR}/uncompress \ ${BINDIR}/compress ${BINDIR}/gzip \ ${BINDIR}/compress ${BINDIR}/gunzip \ ${BINDIR}/compress ${BINDIR}/gzcat \ - ${BINDIR}/zdiff ${BINDIR}/zcmp + ${BINDIR}/zdiff ${BINDIR}/zcmp \ + ${BINDIR}/zmore ${BINDIR}/zless MLINKS+=compress.1 uncompress.1 compress.1 zcat.1 MLINKS+=gzip.1 gunzip.1 gzip.1 gzcat.1 MLINKS+=zdiff.1 zcmp.1 +MLINKS+=zmore.1 zless.1 LDADD=-lz DPADD=${LIBZ} diff --git a/usr.bin/compress/zmore b/usr.bin/compress/zmore index 7e45bcd480f..93378fcc712 100644 --- a/usr.bin/compress/zmore +++ b/usr.bin/compress/zmore @@ -1,6 +1,6 @@ #!/bin/sh - # -# $OpenBSD: zmore,v 1.4 2003/07/29 07:42:45 otto Exp $ +# $OpenBSD: zmore,v 1.5 2007/05/20 00:27:27 jsg Exp $ # # Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> # @@ -39,15 +39,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 - compress -cdfq 2>&1 | ${PAGER-more} $flags + compress -cdfq 2>&1 | $pager $flags exit 0 fi oterm=`stty -g 2>/dev/null` while test $# -ne 0; do - compress -cdfq "$1" 2>&1 | ${PAGER-more} $flags + compress -cdfq "$1" 2>&1 | $pager $flags prev="$1" shift if tty -s && test -n "$oterm" -a $# -gt 0; then diff --git a/usr.bin/compress/zmore.1 b/usr.bin/compress/zmore.1 index d9c67a45cd9..591c6741ca9 100644 --- a/usr.bin/compress/zmore.1 +++ b/usr.bin/compress/zmore.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: zmore.1,v 1.6 2007/01/24 10:53:43 jmc Exp $ +.\" $OpenBSD: zmore.1,v 1.7 2007/05/20 00:27:27 jsg Exp $ .\" .\" Copyright (c) 2003 Todd C. Miller <Todd.Miller@courtesan.com> .\" @@ -22,12 +22,16 @@ .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 ... +.Nm zless +.Op Ar flags +.Op Ar file ... .Sh DESCRIPTION .Nm is a filter that allows the viewing of files compressed with Lempel-Ziv @@ -49,6 +53,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: @@ -84,7 +96,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 , |