gzexe: fix count of lines to skip
[gzip.git] / zmore.in
blobe3e74310fcafc73c3d5ec198dcdba06e59fd5864
1 #!/bin/sh
3 # Copyright (C) 2001-2002, 2007, 2010-2019 Free Software Foundation, Inc.
4 # Copyright (C) 1992, 1993 Jean-loup Gailly
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 3 of the License, or
9 # (at your option) any later version.
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.
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.
20 version="zmore (gzip) @VERSION@
21 Copyright (C) 2010-2018 Free Software Foundation, Inc.
22 This is free software. You may redistribute copies of it under the terms of
23 the GNU General Public License <https://www.gnu.org/licenses/gpl.html>.
24 There is NO WARRANTY, to the extent permitted by law.
26 Written by Jean-loup Gailly."
28 usage="Usage: $0 [OPTION]... [FILE]...
29 Like 'more', but operate on the uncompressed contents of any compressed FILEs.
31 Report bugs to <bug-gzip@gnu.org>."
33 case $1 in
34 --h*) printf '%s\n' "$usage" || exit 1; exit;;
35 --v*) printf '%s\n' "$version" || exit 1; exit;;
36 --) shift;;
37 -?*) printf >&2 '%s\n' "$0: $1: unknown option; try '$0 --help' for help"
38 exit 1;;
39 esac
41 if test $# = 0; then
42 if test -t 0; then
43 printf >&2 '%s\n' "$0: missing operands; try '$0 --help' for help"
44 exit 1
46 set -- -
49 for FILE
51 test $# -lt 2 ||
52 printf '::::::::::::::\n%s\n::::::::::::::\n' "$FILE" || break
53 gzip -cdfq -- "$FILE"
54 done 2>&1 | eval ${PAGER-more}