4 # Copyright (C) 2001, 2002 Free Software Foundation
5 # Copyright (C) 1992, 1993 Jean-loup Gailly
7 # This program is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2 of the License, or
10 # (at your option) any later version.
12 # This program is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License along
18 # with this program; if not, write to the Free Software Foundation, Inc.,
19 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 PATH="BINDIR:$PATH"; export PATH
23 version="zmore (gzip) @VERSION@
24 Copyright (C) 2006 Free Software Foundation, Inc.
25 This is free software. You may redistribute copies of it under the terms of
26 the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
27 There is NO WARRANTY, to the extent permitted by law.
29 Written by Jean-loup Gailly."
31 usage="Usage: zmore [OPTION]... [FILE]...
32 Like 'more', but operate on the uncompressed contents of any compressed FILEs.
34 Report bugs to <bug-gzip@gnu.org>."
36 if test "`echo -n a`" = "-n a"; then
37 # looks like a SysV system:
42 oldtty=`stty -g 2>/dev/null`
43 if stty -cbreak 2>/dev/null; then
44 cb='cbreak'; ncb='-cbreak'
46 # 'stty min 1' resets eof to ^a on both SunOS and SysV!
47 cb='min 1 -icanon'; ncb='icanon eof ^d'
49 if test $? -eq 0 && test -n "$oldtty"; then
50 trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
52 trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
59 gzip -cdfq | eval ${PAGER-more}
66 --h*) exec echo "$usage";;
67 --v*) exec echo "$version";;
71 if test $FIRST -eq 0; then
72 echo $n1 "--More--(Next file: $FILE)$n2"
73 stty $cb -echo 2>/dev/null
74 ANS=`dd bs=1 count=1 2>/dev/null`
75 stty $ncb echo 2>/dev/null
81 if test "$ANS" != 's'; then
82 echo "------> $FILE <------"
83 gzip -cdfq -- "$FILE" | eval ${PAGER-more}