Ticket #2588: cannot set mini-format for "brief" listing type.
[midnight-commander.git] / misc / mc.menu.in
blobb6a6d29d1b9c0742f9f31477d6c2abaaacbbd580
1 shell_patterns=0
2 + ! t t
3 @       Do something on the current file
4         CMD=%{Enter command}
5         $CMD %f
7 + t t
8 @       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         
16 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"
22 =+ f \.1$ | f \.3$ | f \.4$ | f \.5$ | f \.6$ | f \.7$ | f \.8$ | f \.man$ & t r
23 1       Display the file with roff -man
24         %view{ascii,nroff} roff @MAN_FLAGS@ @MANDOC@ %f
26 2       Call the info hypertext browser
27         info
29 = t d
30 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."
39 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."
48 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."
57 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."
66 = f \.c$ & t r
67 + f \.c$ & t r & ! t t
68 c       Compile and link current .c file
69         make `basename %f .c` 2>/dev/null || cc -O -o `basename %f .c` %f
71 + t r & ! t t
72 a       Append file to opposite
73         cat %f >> %D/%f
75 + t t
76 A       Append files to opposite files
77         set %t
78         while [ -n "$1" ]; do
79           cat "$1" >> "%D/$1"
80           shift
81         done
83 + t r & ! t t
84 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."
99         fi
101 + t t
102 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
120         done
122 m       View manual page
123         MAN=%{Enter manual name}
124         %view{ascii,nroff} MANROFFOPT='@MAN_FLAGS@' MAN_KEEP_FORMATTING=1 man -P cat $MAN
126 = f \.gz$ & t r
127 + ! t t
128 n       Inspect gzip'ed newsbatch file
129         dd if=%f bs=1 skip=12|zcat|${PAGER-more}
130         # assuming the cunbatch header is 12 bytes long.
132 = t r &
133 + ! t t
134 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
148 + t t
149 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
170 = t r
171 + ! t t
172 r       Copy file to remote host
173         echo -n "To which host?: "
174         read Host
175         echo -n "To which directory on $Host?: "
176         read Dir
177         rcp -p %f "${Host}:$Dir"
179 + t t
180 R       Copy files to remote host (no error checking)
181         echo -n "Copy files to which host?: "
182         read Host
183         echo -n "To which directory on $Host? :"
184         read Dir
185         rcp -pr %u "${Host}:$Dir"
187 = f \.tex$ & t r
188 + f \.tex$ & t r & ! t t
189 t       Run latex on file and show it with xdvi
190         latex %f && xdvi `basename %f .tex`.dvi
192 =+ f ^part | f ^Part | f uue & t r
193 + t t
194 U       Uudecode marked news articles (needs work)
195         set %t
196         (
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."
207 =+ 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 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 -
238 = t r
239 + ! t t
240 y       Gzip or gunzip current file
241         unset DECOMP
242         case %f in
243             *.gz) DECOMP=-d;;
244             *.[zZ]) DECOMP=-d;;
245         esac
246         gzip $DECOMP -v %f
248 + t t
249 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"
258         done
260 + ! t t
261 b       Bzip2 or bunzip2 current file
262         unset DECOMP
263         case %f in
264             *.bz2) DECOMP=-d;;
265         esac
266         bzip2 $DECOMP -v %f
268 + t t
269 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"
277         done
279 + f \.tar.gz$ | f \.tgz$ | f \.tpz$ | f \.tar.Z$ | f \.tar.z$ | f \.tar.bz2$ | f \.tar.F$ & t r & ! t t
280 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 -)
294 + t t
295 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;;
308           esac
309           mkdir "$D"; (cd "$D" && "$1" "$2" "../$i" | tar xvf -)
310         done
312 + f \.gz$ | f \.tgz$ | f \.tpz$ | f \.Z$ | f \.z$ | f \.bz2$ & t r & ! t t
313 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`";;
328         esac
329         if [ "$EXT" = "bz2" ]; then
330             bunzip2 -v %f ; gzip -f9 -v "$D"
331         else
332             gunzip -v %f ; bzip2 -v "$D"
333         fi
335 + t t
336 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
364         done
366 + x /usr/bin/open | x /usr/local/bin/open & x /bin/sh
367 o       Open next a free console
368         open -s -- sh