From 25c1a8ce91b3ad312e24abc4d7588b9824b2830b Mon Sep 17 00:00:00 2001
From: Andreas Mohr <and@gmx.li>
Date: Sat, 5 Mar 2016 00:07:31 +0000
Subject: [PATCH] mc.menu: quote and whitespace fix
$* must quote unless at cmd/line begin
%* must not quote
1) quoting fix
2) whitespace ident
3) while replaced by for loop
4) header comment (taking from source code)
Signed-off-by: Andreas Mohr <and@gmx.li>
---
misc/mc.menu.in | 487 +++++++++++++++++++++++++++-----------------------------
1 file changed, 237 insertions(+), 250 deletions(-)
diff --git a/misc/mc.menu.in b/misc/mc.menu.in
index b6a6d29..11e587f 100644
a
|
b
|
|
1 | 1 | shell_patterns=0 |
| 2 | # %% The % character |
| 3 | # %f The current file (if non-local vfs, file will be copied locally and |
| 4 | # %f will be full path to it) |
| 5 | # %p The current file |
| 6 | # %d The current working directory |
| 7 | # %s "Selected files"; the tagged files if any, otherwise the current file |
| 8 | # %t Tagged files |
| 9 | # %u Tagged files (and they are untagged on return from expand_format) |
| 10 | # %view Runs the commands and pipes standard output to the view command |
| 11 | # If %view is immediately followed by '{', recognize keywords |
| 12 | # ascii, hex, nroff and unform |
| 13 | # |
| 14 | # If the format letter is in uppercase, it refers to the other panel |
| 15 | # |
| 16 | # With a number followed the % character you can turn quoting on (default) |
| 17 | # and off. For example: |
| 18 | # %f quote expanded macro |
| 19 | # %1f ditto |
| 20 | # %0f don't quote expanded macro |
| 21 | ############################################################################## |
2 | 22 | + ! t t |
3 | 23 | @ Do something on the current file |
4 | | CMD=%{Enter command} |
5 | | $CMD %f |
| 24 | CMD=%{Enter command} |
| 25 | $CMD %f |
6 | 26 | |
7 | 27 | + t t |
8 | 28 | @ Do something on the tagged files |
9 | | set %t; CMD=%{Enter command} |
10 | | while [ -n "$1" ]; do |
11 | | $CMD "$1" |
12 | | shift |
13 | | done |
14 | | |
| 29 | CMD=%{Enter command} |
| 30 | for i in %t ; do |
| 31 | $CMD "$i" |
| 32 | done |
15 | 33 | |
16 | 34 | 0 Edit a bug report and send it to root |
17 | | I=`mktemp "${MC_TMPDIR:-/tmp}/mail.XXXXXX"` || exit 1 |
18 | | ${EDITOR-vi} "$I" |
19 | | test -r $I && mail root < $I |
20 | | rm -f "$I" |
| 35 | I=`mktemp "${MC_TMPDIR:-/tmp}/mail.XXXXXX"` || exit 1 |
| 36 | ${EDITOR-vi} "$I" |
| 37 | test -r "$I" && mail root < "$I" |
| 38 | rm -f "$I" |
21 | 39 | |
22 | 40 | =+ f \.1$ | f \.3$ | f \.4$ | f \.5$ | f \.6$ | f \.7$ | f \.8$ | f \.man$ & t r |
23 | 41 | 1 Display the file with roff -man |
24 | | %view{ascii,nroff} roff @MAN_FLAGS@ @MANDOC@ %f |
| 42 | %view{ascii,nroff} roff @MAN_FLAGS@ @MANDOC@ %f |
25 | 43 | |
26 | 44 | 2 Call the info hypertext browser |
27 | 45 | info |
28 | 46 | |
29 | 47 | = t d |
30 | 48 | 3 Compress the current subdirectory (tar.gz) |
31 | | Pwd=`basename %d /` |
32 | | echo -n "Name of the compressed file (without extension) [$Pwd]: " |
33 | | read tar |
34 | | if [ "$tar"x = x ]; then tar="$Pwd"; fi |
35 | | cd .. && \ |
36 | | tar cf - "$Pwd" | gzip -f9 > "$tar.tar.gz" && \ |
37 | | echo "../$tar.tar.gz created." |
| 49 | Pwd=`basename %d /` |
| 50 | echo -n "Name of the compressed file (without extension) [$Pwd]: " |
| 51 | read tar |
| 52 | [ "$tar"x = x ] && tar="$Pwd" |
| 53 | cd .. && \ |
| 54 | tar cf - "$Pwd" | gzip -f9 > "$tar.tar.gz" && \ |
| 55 | echo "../$tar.tar.gz created." |
38 | 56 | |
39 | 57 | 4 Compress the current subdirectory (tar.bz2) |
40 | | Pwd=`basename %d /` |
41 | | echo -n "Name of the compressed file (without extension) [$Pwd]: " |
42 | | read tar |
43 | | if [ "$tar"x = x ]; then tar="$Pwd"; fi |
44 | | cd .. && \ |
45 | | tar cf - "$Pwd" | bzip2 -f > "$tar.tar.bz2" && \ |
46 | | echo "../$tar.tar.bz2 created." |
| 58 | Pwd=`basename %d /` |
| 59 | echo -n "Name of the compressed file (without extension) [$Pwd]: " |
| 60 | read tar |
| 61 | [ "$tar"x = x ] && tar="$Pwd" |
| 62 | cd .. && \ |
| 63 | tar cf - "$Pwd" | bzip2 -f > "$tar.tar.bz2" && \ |
| 64 | echo "../$tar.tar.bz2 created." |
47 | 65 | |
48 | 66 | 5 Compress the current subdirectory (tar.7z) |
49 | | Pwd=`basename %d /` |
50 | | echo -n "Name of the compressed file (without extension) [$Pwd]: " |
51 | | read tar |
52 | | if [ "$tar"x = x ]; then tar="$Pwd"; fi |
53 | | cd .. && \ |
54 | | tar cf - "$Pwd" | 7za a -si "$tar.tar.7z" && \ |
55 | | echo "../$tar.tar.7z created." |
| 67 | Pwd=`basename %d /` |
| 68 | echo -n "Name of the compressed file (without extension) [$Pwd]: " |
| 69 | read tar |
| 70 | [ "$tar"x = x ] && tar="$Pwd" |
| 71 | cd .. && \ |
| 72 | tar cf - "$Pwd" | 7za a -si "$tar.tar.7z" && \ |
| 73 | echo "../$tar.tar.7z created." |
56 | 74 | |
57 | 75 | 6 Compress the current subdirectory (tar.xz) |
58 | | Pwd=`basename %d /` |
59 | | echo -n "Name of the compressed file (without extension) [$Pwd]: " |
60 | | read tar |
61 | | if [ "$tar"x = x ]; then tar="$Pwd"; fi |
62 | | cd .. && \ |
63 | | tar cf - "$Pwd" | xz -f > "$tar.tar.xz" && \ |
64 | | echo "../$tar.tar.xz created." |
| 76 | Pwd=`basename %d /` |
| 77 | echo -n "Name of the compressed file (without extension) [$Pwd]: " |
| 78 | read tar |
| 79 | [ "$tar"x = x ] && tar="$Pwd" |
| 80 | cd .. && \ |
| 81 | tar cf - "$Pwd" | xz -f > "$tar.tar.xz" && \ |
| 82 | echo "../$tar.tar.xz created." |
65 | 83 | |
66 | 84 | = f \.c$ & t r |
67 | 85 | + f \.c$ & t r & ! t t |
68 | 86 | c Compile and link current .c file |
69 | | make `basename %f .c` 2>/dev/null || cc -O -o `basename %f .c` %f |
| 87 | make "`basename %f .c`" 2>/dev/null || cc -O -o "`basename %f .c`" %f |
70 | 88 | |
71 | 89 | + t r & ! t t |
72 | 90 | a Append file to opposite |
73 | | cat %f >> %D/%f |
| 91 | cat %f >> %D/%f |
74 | 92 | |
75 | 93 | + t t |
76 | 94 | A Append files to opposite files |
77 | | set %t |
78 | | while [ -n "$1" ]; do |
79 | | cat "$1" >> "%D/$1" |
80 | | shift |
81 | | done |
| 95 | for i in %t ; do |
| 96 | cat "$i" >> %D/"$i" |
| 97 | done |
82 | 98 | |
83 | 99 | + t r & ! t t |
84 | 100 | d Delete file if a copy exists in the other directory. |
85 | | if [ "%d" = "%D" ]; then |
86 | | echo "The two directories must be different." |
87 | | exit 1 |
88 | | fi |
89 | | if [ -f %D/%f ]; then # if two of them, then |
90 | | if cmp -s %D/%f %f; then |
91 | | rm %f && echo "%f: DELETED." |
92 | | else |
93 | | echo "%f and %D/%f differ: NOT deleted." |
94 | | echo -n "Press RETURN " |
95 | | read key |
96 | | fi |
97 | | else |
98 | | echo "%f: No copy in %D/%f: NOT deleted." |
| 101 | if [ %d = %D ]; then |
| 102 | echo "The two directories must be different." |
| 103 | exit 1 |
| 104 | fi |
| 105 | if [ -f %D/%f ]; then # if two of them, then |
| 106 | if cmp -s %D/%f %f; then |
| 107 | rm %f && echo %f": DELETED." |
| 108 | else |
| 109 | echo %f" and "%D/%f" differ: NOT deleted." |
| 110 | echo -n "Press RETURN " |
| 111 | read key |
| 112 | fi |
| 113 | else |
| 114 | echo %f": No copy in "%D/%f": NOT deleted." |
99 | 115 | fi |
100 | 116 | |
101 | 117 | + t t |
102 | 118 | D Delete tagged files if a copy exists in the other directory. |
103 | | if [ "%d" = "%D" ]; then |
104 | | echo "The two directores must be different." |
105 | | exit 1 |
106 | | fi |
107 | | for i in %t |
108 | | do |
109 | | if [ -f "%D/$i" ]; then |
110 | | SUM1="`sum \"$i\"`" |
111 | | SUM2="`sum \"%D/$i\"`" |
112 | | if [ "$SUM1" = "$SUM2" ]; then |
113 | | rm "$i" && echo "${i}: DELETED." |
114 | | else |
115 | | echo "$i and %D/$i differ: NOT deleted." |
116 | | fi |
117 | | else |
118 | | echo "$i has no copy in %D: NOT deleted." |
119 | | fi |
| 119 | if [ %d = %D ]; then |
| 120 | echo "The two directores must be different." |
| 121 | exit 1 |
| 122 | fi |
| 123 | for i in %t ; do |
| 124 | if [ -f %D/"$i" ]; then |
| 125 | SUM1=`sum "$i"` |
| 126 | SUM2=`sum %D/"$i"` |
| 127 | if [ "$SUM1" = "$SUM2" ]; then |
| 128 | rm "$i" && echo "${i}: DELETED." |
| 129 | else |
| 130 | echo "$i and "%D"/$i differ: NOT deleted." |
| 131 | fi |
| 132 | else |
| 133 | echo "$i has no copy in "%D": NOT deleted." |
| 134 | fi |
120 | 135 | done |
121 | 136 | |
122 | 137 | m View manual page |
123 | | MAN=%{Enter manual name} |
124 | | %view{ascii,nroff} MANROFFOPT='@MAN_FLAGS@' MAN_KEEP_FORMATTING=1 man -P cat $MAN |
| 138 | MAN=%{Enter manual name} |
| 139 | %view{ascii,nroff} MANROFFOPT='@MAN_FLAGS@' MAN_KEEP_FORMATTING=1 man -P cat "$MAN" |
125 | 140 | |
126 | 141 | = f \.gz$ & t r |
127 | 142 | + ! t t |
128 | 143 | n Inspect gzip'ed newsbatch file |
129 | | dd if=%f bs=1 skip=12|zcat|${PAGER-more} |
| 144 | dd if=%f bs=1 skip=12 | zcat | ${PAGER-more} |
130 | 145 | # assuming the cunbatch header is 12 bytes long. |
131 | 146 | |
132 | 147 | = t r & |
133 | 148 | + ! t t |
134 | 149 | h Strip headers from current newsarticle |
135 | | CHECK=`awk '{print $1 ; exit}' %f` 2>/dev/null |
136 | | case "$CHECK" in |
137 | | Newsgroups:|Path:) |
138 | | I=`mktemp "${MC_TMPDIR:-/tmp}/news.XXXXXX"` || exit 1 |
139 | | cp %f "$I" && sed '/^'"$CHECK"' /,/^$/d' "$I" > %f |
140 | | [ "$?" = "0" ] && rm "$I" |
141 | | echo "%f: header removed." |
142 | | ;; |
143 | | *) |
144 | | echo "%f is not a news article." |
145 | | ;; |
146 | | esac |
| 150 | CHECK=`awk '{print $1 ; exit}' %f` 2>/dev/null |
| 151 | case "$CHECK" in |
| 152 | Newsgroups:|Path:) |
| 153 | I=`mktemp "${MC_TMPDIR:-/tmp}/news.XXXXXX"` || exit 1 |
| 154 | cp %f "$I" && sed '/^'"$CHECK"' /,/^$/d' "$I" > %f |
| 155 | [ "$?" = "0" ] && rm "$I" |
| 156 | echo %f": header removed." |
| 157 | ;; |
| 158 | *) |
| 159 | echo %f" is not a news article." |
| 160 | ;; |
| 161 | esac |
147 | 162 | |
148 | 163 | + t t |
149 | 164 | H Strip headers from the marked newsarticles |
150 | | set %t |
151 | | while [ -n "$1" ]; do |
152 | | CHECK=`awk '{print $1 ; exit}' $1` 2>/dev/null |
153 | | WFILE=`mktemp "${MC_TMPDIR:-/tmp}/news.XXXXXX"` || exit 1 |
154 | | case "$CHECK" in |
155 | | Newsgroups:|Path:) |
156 | | cp "$1" "$WFILE" && sed '/^'"$CHECK"' /,/^$/d' "$WFILE" > "$1" |
157 | | if [ "$?" = "0" ]; then |
158 | | rm "$WFILE"; echo "$1 header removed. OK." |
159 | | else |
160 | | echo "Oops! Please check $1 against $WFILE." |
161 | | fi |
162 | | ;; |
163 | | *) |
164 | | echo "$1 skipped: Not a news article." |
165 | | ;; |
166 | | esac |
167 | | shift |
168 | | done |
| 165 | for i in %t ; do |
| 166 | CHECK=`awk '{print $1 ; exit}' "$i"` 2>/dev/null |
| 167 | WFILE=`mktemp "${MC_TMPDIR:-/tmp}/news.XXXXXX"` || exit 1 |
| 168 | case "$CHECK" in |
| 169 | Newsgroups:|Path:) |
| 170 | cp "$i" "$WFILE" && sed '/^'"$CHECK"' /,/^$/d' "$WFILE" > "$i" |
| 171 | if [ "$?" = "0" ]; then |
| 172 | rm "$WFILE"; echo "$i header removed. OK." |
| 173 | else |
| 174 | echo "Oops! Please check $i against $WFILE." |
| 175 | fi |
| 176 | ;; |
| 177 | *) |
| 178 | echo "$i skipped: Not a news article." |
| 179 | ;; |
| 180 | esac |
| 181 | done |
169 | 182 | |
170 | 183 | = t r |
171 | 184 | + ! t t |
172 | 185 | r Copy file to remote host |
173 | | echo -n "To which host?: " |
| 186 | echo -n "To which host?: " |
174 | 187 | read Host |
175 | 188 | echo -n "To which directory on $Host?: " |
176 | 189 | read Dir |
177 | | rcp -p %f "${Host}:$Dir" |
| 190 | rcp -p %f "${Host}:${Dir}" |
178 | 191 | |
179 | 192 | + t t |
180 | 193 | R Copy files to remote host (no error checking) |
181 | | echo -n "Copy files to which host?: " |
| 194 | echo -n "Copy files to which host?: " |
182 | 195 | read Host |
183 | 196 | echo -n "To which directory on $Host? :" |
184 | 197 | read Dir |
185 | | rcp -pr %u "${Host}:$Dir" |
| 198 | rcp -pr %u "${Host}:${Dir}" |
186 | 199 | |
187 | 200 | = f \.tex$ & t r |
188 | 201 | + f \.tex$ & t r & ! t t |
189 | 202 | t Run latex on file and show it with xdvi |
190 | | latex %f && xdvi `basename %f .tex`.dvi |
| 203 | latex %f && xdvi "`basename %f .tex`".dvi |
191 | 204 | |
192 | 205 | =+ f ^part | f ^Part | f uue & t r |
193 | 206 | + t t |
194 | 207 | U Uudecode marked news articles (needs work) |
195 | | set %t |
196 | 208 | ( |
197 | | while [ -n "$1" ]; do # strip headers |
198 | | FIRST=`awk '{print $1 ; exit}' "$1"` |
199 | | cat "$1" | sed '/^'"$FIRST"' /,/^$/d'; shift |
200 | | done |
201 | | ) |sed '/^$/d' |sed -n '/^begin 6/,/^end$/p' | uudecode |
202 | | if [ "$?" != "0" ]; then |
203 | | echo "Cannot decode %t." |
204 | | fi |
205 | | echo "Please test the output file before deleting anything." |
| 209 | for i in %t ; do # strip headers |
| 210 | FIRST=`awk '{print $1 ; exit}' "$i"` |
| 211 | cat "$i" | sed '/^'"$FIRST"' /,/^$/d' |
| 212 | done |
| 213 | ) | sed '/^$/d' | sed -n '/^begin 6/,/^end$/p' | uudecode |
| 214 | if [ "$?" != "0" ]; then |
| 215 | echo "Cannot decode "%t"." |
| 216 | fi |
| 217 | echo "Please test the output file before deleting anything." |
206 | 218 | |
207 | 219 | =+ f \.tar\.gz$ | f \.tar\.z$ | f \.tgz$ | f \.tpz$ | f \.tar\.lz$ | f \.tar\.lz4$ | f \.tar\.lzma$ | f \.tar\.7z$ | f \.tar\.xz$ | f \.tar\.Z$ | f \.tar\.bz2$ & t r |
208 | 220 | x Extract the contents of a compressed tar file |
209 | | unset PRG |
210 | | case %f in |
211 | | *.tar.bz2) |
212 | | PRG="bunzip2 -c" |
213 | | ;; |
214 | | *.tar.gz|*.tar.z|*.tgz|*.tpz|*.tar.Z) |
215 | | PRG="gzip -dc" |
216 | | ;; |
217 | | *.tar.lzma) |
218 | | PRG="lzma -dc" |
219 | | ;; |
220 | | *.tar.lz) |
221 | | PRG="lzip -dc" |
222 | | ;; |
223 | | *.tar.lz4) |
224 | | PRG="lz4 -dc" |
225 | | ;; |
226 | | *.tar.xz) |
227 | | PRG="xz -dc" |
228 | | ;; |
229 | | *.tar.7z) |
230 | | PRG="7za e -so" |
231 | | ;; |
232 | | *) |
233 | | exit 1 |
234 | | ;; |
235 | | esac |
236 | | $PRG %f | tar xvf - |
| 221 | unset PRG |
| 222 | case %f in |
| 223 | *.tar.7z) PRG="7za e -so";; |
| 224 | *.tar.bz2) PRG="bunzip2 -c";; |
| 225 | *.tar.gz|*.tar.z|*.tgz|*.tpz|*.tar.Z) PRG="gzip -dc";; |
| 226 | *.tar.lz) PRG="lzip -dc";; |
| 227 | *.tar.lz4) PRG="lz4 -dc";; |
| 228 | *.tar.lzma) PRG="lzma -dc";; |
| 229 | *.tar.xz) PRG="xz -dc";; |
| 230 | *) exit 1;; |
| 231 | esac |
| 232 | $PRG %f | tar xvf - |
237 | 233 | |
238 | 234 | = t r |
239 | 235 | + ! t t |
240 | 236 | y Gzip or gunzip current file |
241 | 237 | unset DECOMP |
242 | | case %f in |
243 | | *.gz) DECOMP=-d;; |
244 | | *.[zZ]) DECOMP=-d;; |
245 | | esac |
246 | | gzip $DECOMP -v %f |
| 238 | case %f in |
| 239 | *.gz|*.[zZ]) DECOMP=-d;; |
| 240 | esac |
| 241 | gzip "$DECOMP" -v %f |
247 | 242 | |
248 | 243 | + t t |
249 | 244 | Y Gzip or gunzip tagged files |
250 | | for i in %t |
251 | | do |
252 | | unset DECOMP |
253 | | case "$i" in |
254 | | *.gz) DECOMP=-d;; |
255 | | *.[zZ]) DECOMP=-d;; |
256 | | esac |
257 | | gzip $DECOMP -v "$i" |
| 245 | for i in %t ; do |
| 246 | unset DECOMP |
| 247 | case "$i" in |
| 248 | *.gz|*.[zZ]) DECOMP=-d;; |
| 249 | esac |
| 250 | gzip "$DECOMP" -v "$i" |
258 | 251 | done |
259 | 252 | |
260 | 253 | + ! t t |
261 | 254 | b Bzip2 or bunzip2 current file |
262 | 255 | unset DECOMP |
263 | | case %f in |
264 | | *.bz2) DECOMP=-d;; |
265 | | esac |
266 | | bzip2 $DECOMP -v %f |
| 256 | case %f in |
| 257 | *.bz2) DECOMP=-d;; |
| 258 | esac |
| 259 | bzip2 "$DECOMP" -v %f |
267 | 260 | |
268 | 261 | + t t |
269 | 262 | B Bzip2 or bunzip2 tagged files |
270 | | for i in %t |
271 | | do |
272 | | unset DECOMP |
273 | | case "$i" in |
274 | | *.bz2) DECOMP=-d;; |
275 | | esac |
276 | | bzip2 $DECOMP -v "$i" |
| 263 | for i in %t ; do |
| 264 | unset DECOMP |
| 265 | case "$i" in |
| 266 | *.bz2) DECOMP=-d;; |
| 267 | esac |
| 268 | bzip2 "$DECOMP" -v "$i" |
277 | 269 | done |
278 | 270 | |
279 | 271 | + f \.tar.gz$ | f \.tgz$ | f \.tpz$ | f \.tar.Z$ | f \.tar.z$ | f \.tar.bz2$ | f \.tar.F$ & t r & ! t t |
280 | 272 | z Extract compressed tar file to subdirectory |
281 | | unset D |
282 | | set gzip -cd |
283 | | case %f in |
284 | | *.tar.gz) D="`basename %f .tar.gz`";; |
285 | | *.tgz) D="`basename %f .tgz`";; |
286 | | *.tpz) D="`basename %f .tpz`";; |
287 | | *.tar.Z) D="`basename %f .tar.Z`";; |
288 | | *.tar.z) D="`basename %f .tar.z`";; |
289 | | *.tar.bz2) D="`basename %f .tar.bz2`"; set bunzip2 -c ;; |
290 | | *.tar.F) D="`basename %f .tar.F`"; set freeze -dc; |
291 | | esac |
292 | | mkdir "$D"; cd "$D" && ("$1" "$2" ../%f | tar xvf -) |
| 273 | unset D |
| 274 | set gzip -cd |
| 275 | case %f in |
| 276 | *.tar.F) D=`basename %f .tar.F`; set freeze -dc;; |
| 277 | *.tar.Z) D=`basename %f .tar.Z`;; |
| 278 | *.tar.bz2) D=`basename %f .tar.bz2`; set bunzip2 -c;; |
| 279 | *.tar.gz) D=`basename %f .tar.gz`;; |
| 280 | *.tar.z) D=`basename %f .tar.z`;; |
| 281 | *.tgz) D=`basename %f .tgz`;; |
| 282 | *.tpz) D=`basename %f .tpz`;; |
| 283 | esac |
| 284 | mkdir "$D"; cd "$D" && ("$1" "$2" ../%f | tar xvf -) |
293 | 285 | |
294 | 286 | + t t |
295 | 287 | Z Extract compressed tar files to subdirectories |
296 | | for i in %t |
297 | | do |
298 | | set gzip -dc |
299 | | unset D |
300 | | case "$i" in |
301 | | *.tar.gz) D="`basename $i .tar.gz`";; |
302 | | *.tgz) D="`basename $i .tgz`";; |
303 | | *.tpz) D="`basename $i .tpz`";; |
304 | | *.tar.Z) D="`basename $i .tar.Z`";; |
305 | | *.tar.z) D="`basename $i .tar.z`";; |
306 | | *.tar.F) D="`basename $i .tar.F`"; set freeze -dc;; |
307 | | *.tar.bz2) D="`basename $i .tar.bz2`"; set bunzip2 -c;; |
| 288 | for i in %t ; do |
| 289 | set gzip -dc |
| 290 | unset D |
| 291 | case "$i" in |
| 292 | *.tar.F) D=`basename "$i" .tar.F`; set freeze -dc;; |
| 293 | *.tar.Z) D=`basename "$i" .tar.Z`;; |
| 294 | *.tar.bz2) D=`basename "$i" .tar.bz2`; set bunzip2 -c;; |
| 295 | *.tar.gz) D=`basename "$i" .tar.gz`;; |
| 296 | *.tar.z) D=`basename "$i" .tar.z`;; |
| 297 | *.tgz) D=`basename "$i" .tgz`;; |
| 298 | *.tpz) D=`basename "$i" .tpz`;; |
308 | 299 | esac |
309 | | mkdir "$D"; (cd "$D" && "$1" "$2" "../$i" | tar xvf -) |
| 300 | mkdir "$D"; (cd "$D" && "$1" "$2" "../$i" | tar xvf -) |
310 | 301 | done |
311 | 302 | |
312 | 303 | + f \.gz$ | f \.tgz$ | f \.tpz$ | f \.Z$ | f \.z$ | f \.bz2$ & t r & ! t t |
313 | 304 | c Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2 |
314 | | unset D |
315 | | unset EXT |
316 | | case %f in |
317 | | *.tgz) EXT=tgz;; |
318 | | *.tpz) EXT=tpz;; |
319 | | *.Z) EXT=Z;; |
320 | | *.z) EXT=z;; |
321 | | *.gz) EXT=gz;; |
322 | | *.bz2) EXT=bz2;; |
323 | | esac |
324 | | case $EXT in |
325 | | tgz|tpz) D="`basename %f .$EXT`.tar";; |
326 | | gz|Z|z) D="`basename %f .$EXT`";; |
327 | | bz2) D="`basename %f .bz2`";; |
| 305 | unset D |
| 306 | unset EXT |
| 307 | case %f in |
| 308 | *.Z) EXT=Z;; |
| 309 | *.bz2) EXT=bz2;; |
| 310 | *.gz) EXT=gz;; |
| 311 | *.tgz) EXT=tgz;; |
| 312 | *.tpz) EXT=tpz;; |
| 313 | *.z) EXT=z;; |
| 314 | esac |
| 315 | case "$EXT" in |
| 316 | bz2|Z|gz|z) D=`basename %f ."$EXT"`;; |
| 317 | tgz|tpz) D=`basename %f ."$EXT"`.tar;; |
328 | 318 | esac |
329 | 319 | if [ "$EXT" = "bz2" ]; then |
330 | | bunzip2 -v %f ; gzip -f9 -v "$D" |
331 | | else |
332 | | gunzip -v %f ; bzip2 -v "$D" |
333 | | fi |
| 320 | bunzip2 -v %f |
| 321 | gzip -f9 -v "$D" |
| 322 | else |
| 323 | gunzip -v %f |
| 324 | bzip2 -v "$D" |
| 325 | fi |
334 | 326 | |
335 | 327 | + t t |
336 | 328 | C Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2 |
337 | | set %t |
338 | | while [ -n "$1" ] |
339 | | do |
340 | | unset D |
341 | | unset EXT |
342 | | case "$1" in |
343 | | *.tgz) EXT=tgz;; |
344 | | *.tpz) EXT=tpz;; |
345 | | *.Z) EXT=Z;; |
346 | | *.z) EXT=z;; |
347 | | *.gz) EXT=gz;; |
348 | | *.bz2) EXT=bz2;; |
349 | | esac |
350 | | case $EXT in |
351 | | tgz) D="`basename $1 .tgz`.tar";; |
352 | | tpz) D="`basename $1 .tpz`.tar";; |
353 | | gz|Z|z) D="`basename $1 .$EXT`";; |
354 | | bz2) D="`basename $1 .bz2`";; |
355 | | esac |
356 | | if [ "$EXT" = "bz2" ]; then |
357 | | bunzip2 -v "$1" |
358 | | gzip -f9 -v "$D" |
359 | | else |
360 | | gunzip -v "$1" |
361 | | bzip2 -v "$D" |
362 | | fi |
363 | | shift |
| 329 | for i in %t ; do |
| 330 | unset D |
| 331 | unset EXT |
| 332 | case "$i" in |
| 333 | *.Z) EXT=Z;; |
| 334 | *.bz2) EXT=bz2;; |
| 335 | *.gz) EXT=gz;; |
| 336 | *.tgz) EXT=tgz;; |
| 337 | *.tpz) EXT=tpz;; |
| 338 | *.z) EXT=z;; |
| 339 | esac |
| 340 | case "$EXT" in |
| 341 | bz2|Z|gz|z) D=`basename "$i" ."$EXT"`;; |
| 342 | tgz|tpz) D=`basename "$i" ."$EXT"`.tar;; |
| 343 | esac |
| 344 | if [ "$EXT" = "bz2" ]; then |
| 345 | bunzip2 -v "$i" |
| 346 | gzip -f9 -v "$D" |
| 347 | else |
| 348 | gunzip -v "$i" |
| 349 | bzip2 -v "$D" |
| 350 | fi |
364 | 351 | done |
365 | 352 | |
366 | 353 | + x /usr/bin/open | x /usr/local/bin/open & x /bin/sh |