6 # Permission to use, copy, modify, distribute and sell this software
7 # and its documentation for any purpose is hereby granted without
8 # fee, provided that the above copyright notice appear in all copies
9 # and that both that copyright notice and this permission notice
10 # appear in supporting documentation. Kevin Atkinson makes no
11 # representations about the suitability of this software for any
12 # purpose. It is provided "as is" without express or implied
19 if test -z "$quiet"; then echo "$cmd: $1" >&2 ; fi
32 prezip-bin -d "$cmd: $2"
37 LC_COLLATE=C sort -u | prezip-bin -z "$cmd: $2"
39 prezip-bin -z "$cmd: $2"
54 if test -e "$3" -a ! "$force"
56 error "Output file $3 already exists."
59 zip2 $1 "$2: " < "$2" > "$3"
62 if test -z "$keep"; then rm "$2"; fi
73 precat) mode=d; stdout=t ;;
82 parm=`expr "x$p" : '...\(.*\)'`
84 decompress ) mode=d ;;
95 * ) error "invalid option -- $parm";;
99 p=`expr "x$p" : '..\(.*\)'`
102 parm=`expr "$p" : '\(.\)'`
103 p=`expr "$p" : '.\(.*\)'`
116 * ) error "invalid option -- $parm";;
136 usage $0 [-dzhLV] [-cfksSq] [file ...]
138 -h --help display help
139 -d --decompress force decompression
140 -z --compress dorce compression
141 -L --license display software license
142 -V --version display version
144 -c --stdout decompress to standard output
146 -k --keep keep input files
147 -s --sort sort and remove duplicates before compressing
148 -S --nocwl do not rename .wl suffix to .cwl (use .wl.pz instead)
149 -q --quiet suppress all warnings
151 If invoked as "prezip" the default action is to compress.
152 as "preunzip" the default action is to decompress.
153 as "precat" the default action is to decompress to stdout.
155 If no file names are given then prezip will compress or decompress
156 from the standard input to the standard output. Short flags can be
157 combined so that "-c -s" is the same as "-cs".
159 Prezip is _not_ a general purpose compressor. It should only be
160 used on sorted word lists or other similar text files. It will
161 likely _increase_ the size of binary data.
172 Permission to use, copy, modify, distribute and sell this software
173 and its documentation for any purpose is hereby granted without
174 fee, provided that the above copyright notice appear in all copies
175 and that both that copyright notice and this permission notice
176 appear in supporting documentation. Kevin Atkinson makes no
177 representations about the suitability of this software for any
178 purpose. It is provided "as is" without express or implied
194 if test \( -f "$f" -a ! -L "$f" \) \
195 -o \( \( "$stdout" -o "$force" \) -a -L "$f" \)
199 zip2 $mode "$f: " < "$f"
205 base=`basename "$f" .pz`
206 base2=`basename "$f" .cwl`
207 if test "$file" != "$base"
211 elif test "$file" != "$base2"
218 warn "can't guess original name - using \"$out\""
221 warn "$f does not end in .pz or .cwl - ignored"
227 base=`basename "$f" .wl`
228 if test "$nocwl" -o "$file" = "$base"
232 zip z "$f" "$dir/$base.cwl"
239 warn "$f is not a regular file - ignored"
241 error "$f: No such file"