[1046] | 1 | #!/bin/sh
|
---|
| 2 |
|
---|
| 3 | # Copyright (C) 2001, 2002, 2007 Free Software Foundation
|
---|
| 4 | # Copyright (C) 1992, 1993 Jean-loup Gailly
|
---|
| 5 |
|
---|
| 6 | # This program is free software; you can redistribute it and/or modify
|
---|
| 7 | # it under the terms of the GNU General Public License as published by
|
---|
| 8 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 9 | # (at your option) any later version.
|
---|
| 10 |
|
---|
| 11 | # This program is distributed in the hope that it will be useful,
|
---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 14 | # GNU General Public License for more details.
|
---|
| 15 |
|
---|
| 16 | # You should have received a copy of the GNU General Public License along
|
---|
| 17 | # with this program; if not, write to the Free Software Foundation, Inc.,
|
---|
| 18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
---|
| 19 |
|
---|
| 20 | PATH="${GZIP_BINDIR-'/usr/bin'}:$PATH"; export PATH
|
---|
| 21 |
|
---|
| 22 | version="zmore (gzip) 1.3.12
|
---|
| 23 | Copyright (C) 2007 Free Software Foundation, Inc.
|
---|
| 24 | This is free software. You may redistribute copies of it under the terms of
|
---|
| 25 | the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
|
---|
| 26 | There is NO WARRANTY, to the extent permitted by law.
|
---|
| 27 |
|
---|
| 28 | Written by Jean-loup Gailly."
|
---|
| 29 |
|
---|
| 30 | usage="Usage: $0 [OPTION]... [FILE]...
|
---|
| 31 | Like 'more', but operate on the uncompressed contents of any compressed FILEs.
|
---|
| 32 |
|
---|
| 33 | Report bugs to <bug-gzip@gnu.org>."
|
---|
| 34 |
|
---|
| 35 | if test "`echo -n a`" = "-n a"; then
|
---|
| 36 | # looks like a SysV system:
|
---|
| 37 | n1=''; n2='\c'
|
---|
| 38 | else
|
---|
| 39 | n1='-n'; n2=''
|
---|
| 40 | fi
|
---|
| 41 | oldtty=`stty -g 2>/dev/null`
|
---|
| 42 | if stty -cbreak 2>/dev/null; then
|
---|
| 43 | cb='cbreak'; ncb='-cbreak'
|
---|
| 44 | else
|
---|
| 45 | # 'stty min 1' resets eof to ^a on both SunOS and SysV!
|
---|
| 46 | cb='min 1 -icanon'; ncb='icanon eof ^d'
|
---|
| 47 | fi
|
---|
| 48 | if test $? -eq 0 && test -n "$oldtty"; then
|
---|
| 49 | trap 'stty $oldtty 2>/dev/null; exit' 0 2 3 5 10 13 15
|
---|
| 50 | else
|
---|
| 51 | trap 'stty $ncb echo 2>/dev/null; exit' 0 2 3 5 10 13 15
|
---|
| 52 | fi
|
---|
| 53 |
|
---|
| 54 | if test $# = 0; then
|
---|
| 55 | if test -t 0; then
|
---|
| 56 | echo "$usage"
|
---|
| 57 | else
|
---|
| 58 | gzip -cdfq | eval more
|
---|
| 59 | fi
|
---|
| 60 | else
|
---|
| 61 | FIRST=1
|
---|
| 62 | for FILE
|
---|
| 63 | do
|
---|
| 64 | case $FILE in
|
---|
| 65 | --h*) exec echo "$usage";;
|
---|
| 66 | --v*) exec echo "$version";;
|
---|
| 67 | esac
|
---|
| 68 |
|
---|
| 69 | < "$FILE" || continue
|
---|
| 70 | if test $FIRST -eq 0; then
|
---|
| 71 | echo $n1 "--More--(Next file: $FILE)$n2"
|
---|
| 72 | stty $cb -echo 2>/dev/null
|
---|
| 73 | ANS=`dd bs=1 count=1 2>/dev/null`
|
---|
| 74 | stty $ncb echo 2>/dev/null
|
---|
| 75 | echo " "
|
---|
| 76 | case "$ANS" in
|
---|
| 77 | [eq]) exit;;
|
---|
| 78 | esac
|
---|
| 79 | fi
|
---|
| 80 | if test "$ANS" != 's'; then
|
---|
| 81 | echo "------> $FILE <------"
|
---|
| 82 | gzip -cdfq -- "$FILE" | more
|
---|
| 83 | fi
|
---|
| 84 | if test -t 1; then
|
---|
| 85 | FIRST=0
|
---|
| 86 | fi
|
---|
| 87 | done
|
---|
| 88 | fi
|
---|