From e368a7bf45c060b9b6d89d23467edd46afc11ad6 Mon Sep 17 00:00:00 2001 From: Jonathan Gray Date: Sun, 20 May 2007 00:27:28 +0000 Subject: 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@ --- usr.bin/compress/zmore | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'usr.bin/compress/zmore') 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 # @@ -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 -- cgit v1.2.3