Add ifmedia(4) reference.
[dragonfly/netmp.git] / usr.bin / gzip / zforce
blob4849a05d41955c630d610de45e63bb64761afb52
1 #!/bin/sh -
3 # $NetBSD: zforce,v 1.2 2003/12/28 12:43:43 wiz Exp $
4 # $DragonFly: src/usr.bin/gzip/zforce,v 1.1 2004/10/26 11:19:31 joerg Exp $
5 # $OpenBSD: zforce,v 1.2 2003/08/05 18:22:17 deraadt Exp $
7 # Copyright (c) 2003 Otto Moerbeek <otto@drijf.net>
9 # Permission to use, copy, modify, and distribute this software for any
10 # purpose with or without fee is hereby granted, provided that the above
11 # copyright notice and this permission notice appear in all copies.
13 # THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
14 # WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
15 # MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
16 # ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
17 # WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
18 # ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
19 # OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
21 prog=`basename $0`
22 USAGE="usage: $prog file ..."
23 if test $# -eq 0; then
24 echo $USAGE
25 exit 1
28 ret=0
30 while test $# -ne 0; do
31 case "$1" in
32 *[._-]gz)
33 shift
35 *.t[ag]z)
36 shift
39 if file "$1" |
40 grep -q "gzip compressed data" 2> /dev/null
41 then
42 n="$1".gz
43 if mv "$1" "$n" 2> /dev/null; then
44 echo "$1" -- renamed to "$n"
45 else
46 ret=1
47 echo $prog: cannot rename "$1" to "$n"
50 shift
52 esac
53 done
54 exit $ret