diagnose unexpected EOF and zero lengths in packed data
[gzip.git] / zcmp.in
blobeab0ea4b1f1ebaf3677e843d654d4c09f51050e7
1 #!/bin/sh
2 # Compare the uncompressed contents of compressed files, byte by byte.
4 # Copyright (C) 2007, 2010-2012 Free Software Foundation, Inc.
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 bindir=@bindir@
21 case $1 in
22 --__bindir) bindir=${2?}; shift; shift;;
23 esac
24 PATH=$bindir:$PATH
26 version="zcmp (gzip) @VERSION@
27 Copyright (C) 2010 Free Software Foundation, Inc.
28 This is free software. You may redistribute copies of it under the terms of
29 the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
30 There is NO WARRANTY, to the extent permitted by law.
32 Written by Paul Eggert."
34 usage="Usage: $0 [OPTION]... FILE1 [FILE2]
35 Compare FILE1 to FILE2 byte by byte, using their uncompressed contents
36 if they are compressed. If FILE2 is omitted, compare FILE1 to the
37 uncompressed contents of FILE1.gz. Do comparisons like 'cmp' does.
39 Options are the same as for 'cmp'.
41 If a FILE is '-' or missing, read standard input.
43 Report bugs to <bug-gzip@gnu.org>."
45 st=0
46 case $1 in
47 --help) echo "$usage" || st=2; exit $st;;
48 --version) echo "$version" || st=2; exit $st;;
49 esac
51 exec zdiff --__cmp "$@"