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/compress/zmore | |
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/compress/zmore')
-rw-r--r-- | usr.bin/compress/zmore | 12 |
1 files changed, 9 insertions, 3 deletions
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 |