Initial xloong code
[xloong.git] / pmon / cmds / newgzip / sample / zfile
blob6b4514ccb307a5b0804d166c7449a2ff651e6281
1 #!/bin/sh
3 if test $# = 0; then
4 echo 'zfile: file(1) for programs which may be compressed with gzexe'
5 echo usage: `basename $0` files...
6 exit 1
7 fi
9 tmp=/tmp/gz$$
11 for i do
12 if test ! -f "$i" ; then
13 echo `basename $0`: $i not a file
14 res=1
15 continue
17 skip=18
18 if sed -e 1d -e 2q "$i" | grep "^skip=[0-9]*$" >/dev/null; then
19 eval `sed -e 1d -e 2q "$i"`
21 if tail +$skip "$i" | gzip --list >/dev/null 2>&1; then
22 tail +$skip "$i" | gzip -cd | dd count=1 >$tmp 2>/dev/null
23 file $tmp | sed "s|^$tmp|$i|"
24 else
25 file "$i"
27 rm -f $tmp
28 done