mirror of
https://https.git.savannah.gnu.org/git/gzip.git
synced 2026-01-27 09:54:33 +00:00
* gzexe.in, zdiff.in, zgrep.in: Run expr and sed in the C locale when it might help to avoid undefined behavior on non-GNU platforms. * sample/zfile, znew.in: Run in the C locale, for simplicity and to avoid undefined behavior on non-GNU platforms.
32 lines
608 B
Bash
Executable File
32 lines
608 B
Bash
Executable File
#!/bin/sh
|
|
|
|
LC_ALL=C
|
|
export LC_ALL
|
|
|
|
if test $# = 0; then
|
|
echo 'zfile: file(1) for programs which may be compressed with gzexe'
|
|
echo usage: `basename $0` files...
|
|
exit 1
|
|
fi
|
|
|
|
tmp=/tmp/gz$$
|
|
|
|
for i do
|
|
if test ! -f "$i" ; then
|
|
echo `basename $0`: $i not a file
|
|
res=1
|
|
continue
|
|
fi
|
|
skip=18
|
|
if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then
|
|
eval `sed -e 1d -e 2q "$i"`
|
|
fi
|
|
if tail +$skip "$i" | gzip --list >/dev/null 2>&1; then
|
|
tail +$skip "$i" | gzip -cd | dd count=1 >$tmp 2>/dev/null
|
|
file $tmp | sed "s|^$tmp|$i|"
|
|
else
|
|
file "$i"
|
|
fi
|
|
rm -f $tmp
|
|
done
|