~ubuntu-branches/ubuntu/lucid/gzip/lucid

« back to all changes in this revision

Viewing changes to znew.in

  • Committer: Bazaar Package Importer
  • Author(s): Bdale Garbee
  • Date: 2008-04-15 14:03:26 UTC
  • mfrom: (2.1.8 hardy)
  • Revision ID: james.westby@ubuntu.com-20080415140326-tt0bpzc652x56msg
Tags: 1.3.12-6
* strip the win32 gzip.exe binary during install, closes: #464455
* patch from Reuben Thomas for the zless.1 man page with pointers to 
  lessfile and lesspipe, which are a better solution than zless in most
  cases... closes: #46787, #51162
* fix FTBFS when using gcc-4.3, closes: #476031
* remove the preinst since the --assert-support-predepends check should
  no longer be necessary

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
:
2
1
#!/bin/sh
3
2
 
 
3
# Copyright (C) 1998, 2002, 2004, 2007 Free Software Foundation
 
4
# Copyright (C) 1993 Jean-loup Gailly
 
5
 
 
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 2 of the License, or
 
9
# (at your option) any later version.
 
10
 
 
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.
 
15
 
 
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.
 
19
 
4
20
PATH="BINDIR:$PATH"; export PATH
 
21
 
 
22
version="znew (gzip) @VERSION@
 
23
Copyright (C) 2007 Free Software Foundation, Inc.
 
24
This is free software.  You may redistribute copies of it under the terms of
 
25
the GNU General Public License <http://www.gnu.org/licenses/gpl.html>.
 
26
There is NO WARRANTY, to the extent permitted by law.
 
27
 
 
28
Written by Jean-loup Gailly."
 
29
 
 
30
usage="Usage: $0 [OPTION]... [FILE]...
 
31
Recompress files from .Z (compress) format to .gz (gzip) format.
 
32
 
 
33
Options:
 
34
 
 
35
  -f     Force recompression even if a .gz file already exists.
 
36
  -t     Test the new files before deleting originals.
 
37
  -v     Verbose; display name and statistics for each file compressed.
 
38
  -9     Use the slowest compression method (optimal compression).
 
39
  -P     Use pipes for the conversion to reduce disk space usage.
 
40
  -K     Keep a .Z file when it is smaller than the .gz file.
 
41
      --help     display this help and exit
 
42
      --version  output version information and exit
 
43
 
 
44
Report bugs to <bug-gzip@gnu.org>."
 
45
 
5
46
check=0
6
47
pipe=0
7
48
opt=
14
55
# block is the disk block size (best guess, need not be exact)
15
56
 
16
57
warn="(does not preserve modes and timestamp)"
17
 
tmp=/tmp/zfoo.$$
 
58
tmp=${TMPDIR-/tmp}/zfoo.$$
18
59
set -C
19
 
echo hi > $tmp.1 || exit 1
20
 
echo hi > $tmp.2 || exit 1
21
 
if test -z "`(${CPMOD-cpmod} $tmp.1 $tmp.2) 2>&1`"; then
 
60
echo hi > $tmp || exit
 
61
if test -z "`(${CPMOD-cpmod} $tmp $tmp) 2>&1`"; then
22
62
  cpmod=${CPMOD-cpmod}
23
63
  warn=""
24
64
fi
25
65
 
26
 
if test -z "$cpmod" && ${TOUCH-touch} -r $tmp.1 $tmp.2 2>/dev/null; then
 
66
if test -z "$cpmod" && ${TOUCH-touch} -r $tmp $tmp 2>/dev/null; then
27
67
  cpmod="${TOUCH-touch}"
28
68
  cpmodarg="-r"
29
69
  warn="(does not preserve file modes)"
30
70
fi
31
71
 
32
72
# check if GZIP env. variable uses -S or --suffix
33
 
gzip -q $tmp.1
34
 
ext=`echo $tmp.1* | sed "s|$tmp.1||"`
35
 
rm -f $tmp.[12]*
 
73
gzip -q $tmp
 
74
ext=`echo $tmp* | sed "s|$tmp||"`
 
75
rm -f $tmp*
36
76
if test -z "$ext"; then
37
77
  echo znew: error determining gzip extension
38
78
  exit 1
45
85
for arg
46
86
do
47
87
  case "$arg" in
 
88
  --help)      exec echo "$usage";;
 
89
  --version)   exec echo "$version";;
48
90
  -*)     opt="$opt $arg"; shift;;
49
91
   *)     break;;
50
92
  esac
51
93
done
52
94
 
53
95
if test $# -eq 0; then
54
 
  echo "recompress .Z files into $ext (gzip) files"
55
 
  echo usage: `echo $0 | sed 's,^.*/,,'` "[-tv9KP]" file.Z...
56
 
  echo "  -t tests the new files before deleting originals"
57
 
  echo "  -v be verbose"
58
 
  echo "  -9 use the slowest compression method (optimal compression)"
59
 
  echo "  -K keep a .Z file when it is smaller than the $ext file"
60
 
  echo "  -P use pipes for the conversion $warn"
 
96
  echo "$usage"
61
97
  exit 1
62
98
fi
63
99