2 # zforce: force a gz extension on all gzip files so that gzip will not
5 # This can be useful for files with names truncated after a file transfer.
6 # foo is renamed to foo.gz
8 # $FreeBSD: src/gnu/usr.bin/gzip/zforce,v 1.5 1999/08/27 23:35:55 peter Exp $
9 # $DragonFly: src/gnu/usr.bin/gzip/Attic/zforce,v 1.2 2003/06/17 04:25:46 dillon Exp $
13 echo "force a '.gz' extension on all gzip files"
14 echo usage: $x files...
20 if test ! -f "$i" ; then
21 echo ${x}: $i not a file
25 test `expr "$i" : '.*[.-]z$'` -eq 0 || continue
26 test `expr "$i" : '.*[.-]gz$'` -eq 0 || continue
27 test `expr "$i" : '.*[.]t[ag]z$'` -eq 0 || continue
29 if gzip -lv < "$i" 2>/dev/null | grep '^defl' > /dev/null; then
32 if mv "$i" "$new" 2>/dev/null; then
33 echo $i -- replaced with $new
36 res=1; echo ${x}: cannot rename $i to $new