mc/lib/mc.menu
Miguel de Icaza 7a4cf0fcbb 2000-01-15 Federico Mena Quintero <federico@helixcode.com>
* lib/mc.menu (shell_patterns): Add a missing "esac".  Thanks to
	Martin Bialasinski <martin@internet-treff.uni-koeln.de> for
	providing a patch.
2000-01-16 02:39:13 +00:00

338 lines
9.4 KiB
Plaintext

shell_patterns=0
+ ! t t
@ Do something on the current file
CMD=%{Enter command}
$CMD ./%0f
+ t t
@ Do something on the tagged files
set %u; CMD=%0{Enter command}
while [ -n "$1" ]; do
$CMD "$1" || echo tag "$1" >>$MC_CONTROL_FILE
shift
done
0 Edit a bug report and send it to root
${EDITOR-vi} /tmp/mail.$$
test -r /tmp/mail.$$ && mail root < /tmp/mail.$$
rm -f /tmp/mail.$$
=+ f \.1$ | f \.3$ | f \.4$ | f \.5$ | f \.6$ | f \.7$ | f \.8$ | f \.man$ & t r
1 Display the file with roff -man
nroff -man %f | less
2 Call the info hypertext browser
info
= t d
3 Make a release of the current subdirectory (tar.gz)
Pwd=`basename %d /`
echo -n "Name of the distribution file (without extension) [$Pwd]: "
read tar
if [ "$tar"x = x ]; then tar=$Pwd; fi
cd .. && tar chf - $Pwd | gzip -f9 > $tar.tar.gz
echo ../${tar}.tar.gz created.
# tar=%{Name of the distribution file (without extension)}
4 Make a release of the current subdirectory (tar.bz2)
Pwd=`basename %d /`
echo -n "Name of the distribution file (without extension) [$Pwd]: "
read tar
if [ "$tar"x = x ]; then tar=$Pwd; fi
cd .. && tar chf - $Pwd | bzip2 -f --repetitive-best > $tar.tar.bz2
echo ../${tar}.tar.bz2 created.
# tar=%{Name of the distribution file (without extension)}
= f \.c$ & t r
+ f \.c$ & t r & ! t t
5 Compile and link current .c file
make `basename %f .c` 2>/dev/null || cc -O -o `basename %f .c` %f
+ t r & ! t t
a Append file to opposite
cat %f >>%D/%f
+ t t
A Append files to opposite files
set %u
while [ -n "$1" ]; do
cat $1 >>%D/$1 || echo tag $1 >>$MC_CONTROL_FILE
shift
done
+ t r & ! t t
d Delete file if a copy exists in the other directory.
if [ "%d" = "%D" ]; then
echo "The two directores must be different"
exit 1
fi
if [ -f %D/%f ]; then # if two of them, then
if cmp -s %D/%f %f; then
rm %f && echo %f: DELETED
else
echo "%f and %D/%f differ: NOT deleted"
echo -n "Press RETURN "
read key
fi
else
echo %f: No copy in %D/%f: NOT deleted.
fi
+ t t
D Delete tagged files if a copy exists in the other directory.
if [ "%d" = "%D" ]; then
echo "The two directores must be different"
exit 1
fi
for i in %t
do
if [ -f %D/$i ]; then
SUM1="`sum $i`"
SUM2="`sum %D/$i`"
if [ "$SUM1" = "$SUM2" ]; then
rm $i && echo ${i}: DELETED
else
echo $i and %D/$i differ: NOT deleted.
fi
else
echo %f has no copy in %D/%f: NOT deleted.
fi
done
= f \.gz$ & t r
+ ! t t
n Inspect gzip'ed newsbatch file
dd if=%f bs=1 skip=12|zcat|${PAGER-more}
# assuming the cunbatch header is 12 bytes long.
= t r &
+ ! t t
h Strip headers from current newsarticle
CHECK=`sed 1q < %f|awk '{print $1}'` 2>/dev/null
case $CHECK in
Newsgroups:|Path:)
cp %f /tmp/%f.$$ && sed '/^'"$CHECK"' /,/^$/d' /tmp/%f.$$ > %f
[ "$?" = "0" ] && rm /tmp/%f.$$
echo %f: header removed
;;
*)
echo %f is not a news article.
;;
esac
+ t t
H Strip headers from the marked newsarticles
set %u
while [ -n "$1" ]; do
CHECK=`sed 1q < $1|awk '{print $1}'` 2>/dev/null
WFILE=/tmp/${1}.$$
case $CHECK in
Newsgroups:|Path:)
cp $1 $WFILE && sed '/^'"$CHECK"' /,/^$/d' $WFILE > $1
if [ "$?" = "0" ]; then
rm $WFILE; echo $1 header removed. OK.
else
echo tag $1 >>$MC_CONTROL_FILE
echo "Oops! Please check $1 against $WFILE"
fi
;;
*)
echo $1 skipped: Not a news article.
echo tag $1 >>$MC_CONTROL_FILE
;;
esac
shift
done
= t r
+ ! t t
r Copy file to remote host
echo -n "To which host?: "
read Host
echo -n "To which directory on $Host?: "
read Dir
rcp -p %f ${Host}:$Dir
+ t t
R Copy files to remote host (no error checking)
echo -n "Copy files to which host?: "
read Host
echo -n "To which directory on $Host? :"
read Dir
rcp -pr %u ${Host}:$Dir
= f \.tex$ & t r
+ f \.tex$ & t r & ! t t
t Run latex on file and show it with xdvi
latex %f && xdvi `basename %f .tex`.dvi
=+ f ^part | f ^Part | f uue & t r
+ t t
U Uudecode marked news articles (needs work)
set %u
(
while [ -n "$1" ]; do # strip headers
FIRST=`sed 1q < $1|awk '{print $1}'`
cat $1 | sed '/^'"$FIRST"' /,/^$/d'; shift
done
) |sed '/^$/d' |sed -n '/^begin 6/,/^end$/p' | uudecode
if [ "$?" != "0" ]; then
echo "Could not decode %t"
for i in %t; do
echo tag $i >>$MC_CONTROL_FILE
shift
done
fi
echo "Please test the output file before deleting anything"
=+ f \.tar\.gz$ | f \.tar\.z$ | f \.tgz$ | f \.tpz$ | f \.tar\.Z$| f \.tar\.bz2$ & t r
x Extract the contents of a compressed tar file
unset EXT
echo %f|egrep -q "\.tar.bz2$" && EXT=tar_bz2
if [ "$EXT" = "tar_bz2" ]; then
bunzip2 -c %f | tar xvf -
else
gzip -dc %f | tar xvf -
fi
= t r
+ ! t t
y Gzip or gunzip current file
unset DECOMP
echo %f|egrep -q "\.gz$|\.z$|\.Z$" && DECOMP=-d
gzip $DECOMP -v %f
+ t t
Y Gzip or gunzip tagged files
for i in %t
do
unset DECOMP
echo $i|egrep -q "\.gz$|\.z$|\.Z$" && DECOMP=-d
gzip $DECOMP -v $i
done
+ ! t t
b Bzip2 or bunzip2 current file
unset DECOMP
echo %f|egrep -q "\.bz2$" && DECOMP=-d
bzip2 $DECOMP -v %f
+ t t
B Bzip2 or bunzip2 tagged files
for i in %t
do
unset DECOMP
echo $i|egrep -q "\.bz2$" && DECOMP=-d
bzip2 $DECOMP -v $i
done
+ f \.tar.gz$ | f \.tgz$ | f \.tpz$ | f \.tar.Z$ | f \.tar.z$ | f \.tar.bz2$ & t r & ! t t
z Extract compressed tar file to subdirectory
unset D
echo %f|egrep -q "\.tar.gz$" && EXT=tar_gz
echo %f|egrep -q "\.tgz$" && EXT=tgz
echo %f|egrep -q "\.tpz$" && EXT=tpz
echo %f|egrep -q "\.tar.Z$" && EXT=tar_Z
echo %f|egrep -q "\.tar.z$" && EXT=tar_z
echo %f|egrep -q "\.tar.bz2$" && EXT=tar_bz2
case $EXT in
tar_gz) D="`basename %f .tar.gz`";;
tgz) D="`basename %f .tgz`";;
tpz) D="`basename %f .tpz`";;
tar_Z) D="`basename %f .tar.Z`";;
tar_z) D="`basename %f .tar.z`";;
tar_bz2) D="`basename %f .tar.bz2`";;
esac
if [ "$EXT" = "tar_bz2" ]; then
mkdir $D; cd $D && (bunzip2 -c ../%f | tar xvf -)
else
mkdir $D; cd $D && (gzip -dc ../%f | tar xvf -)
fi
+ f \.tar.F$ & t r & ! t t
z Extract compressed tar file to subdirectory
unset D
echo %f|egrep -q "\.tar.F$" && EXT=tar_F
case $EXT in
tar_F) D="`basename %f .tar.F`";;
esac
mkdir $D; cd $D && (freeze -dc ../%f | tar xvf -)
+ t t
Z Extract compressed tar files to subdirectories
set %u
while [ -n "$1" ]
do
unset D
echo $1|egrep -q "\.tar.gz$" && EXT=tar_gz
echo $1|egrep -q "\.tgz$" && EXT=tgz
echo $1|egrep -q "\.tpz$" && EXT=tpz
echo $1|egrep -q "\.tar.Z$" && EXT=tar_Z
echo $1|egrep -q "\.tar.z$" && EXT=tar_z
echo $1|egrep -q "\.tar.F$" && EXT=tar_F
echo $1|egrep -q "\.tar.bz2$" && EXT=tar_bz2
case $EXT in
tar_gz) D="`basename $1 .tar.gz`";;
tgz) D="`basename $1 .tgz`";;
tpz) D="`basename $1 .tpz`";;
tar_Z) D="`basename $1 .tar.Z`";;
tar_z) D="`basename $1 .tar.z`";;
tar_F) D="`basename $1 .tar.F`";;
tar_bz2) D="`basename $1 .tar.bz2`";;
esac
case $EXT in
tar_gz|tgz|tpz|tar_Z|tar_z) mkdir $D; (cd $D && gzip -dc ../$1 | tar xvf -)||echo tag $1 >>$MC_CONTROL_FILE;;
tar_F) mkdir $D; (cd $D && freeze -dc ../$1 | tar xvf -)||echo tag $1 >>$MC_CONTROL_FILE;;
tar_bz2) mkdir $D; (cd $D && bunzip2 -c ../$1 | tar xvf -)||echo tag $1 >>$MC_CONTROL_FILE
esac
shift
done
+ f \.gz$ | f \.tgz$ | f \.tpz$ | f \.Z$ | f \.z$ | f \.bz2$ & t r & ! t t
c Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2
unset D
echo %f|egrep -q "\.tgz$" && EXT=tgz
echo %f|egrep -q "\.tpz$" && EXT=tpz
echo %f|egrep -q "\.Z$" && EXT=Z
echo %f|egrep -q "\.z$" && EXT=z
echo %f|egrep -q "\.gz$" && EXT=gz
echo %f|egrep -q "\.bz2$" && EXT=bz2
case $EXT in
tgz) D="`basename %f .tgz`.tar";;
tpz) D="`basename %f .tpz`.tar";;
gz) D="`basename %f .gz`";;
bz2) D="`basename %f .bz2`";;
esac
if [ "$EXT" = "bz2" ]; then
bunzip2 -v %f ; gzip -f9 -v $D
else
gunzip -v %f ; bzip2 -v --repetitive-best $D
fi
+ t t
C Convert gz<->bz2, tar.gz<->tar.bz2 & tgz->tar.bz2
set %u
while [ -n "$1" ]
do
unset D
echo %f|egrep -q "\.tgz$" && EXT=tgz
echo %f|egrep -q "\.tpz$" && EXT=tpz
echo %f|egrep -q "\.Z$" && EXT=Z
echo %f|egrep -q "\.z$" && EXT=z
echo %f|egrep -q "\.gz$" && EXT=gz
echo %f|egrep -q "\.bz2$" && EXT=bz2
case $EXT in
tgz) D="`basename $1 .tgz`.tar";;
tpz) D="`basename $1 .tpz`.tar";;
gz) D="`basename $1 .gz`";;
bz2) D="`basename $1 .bz2`";;
esac
if [ "$EXT" = "bz2" ]; then
(bunzip2 -v $1 ; gzip -f9 -v $D)||echo tag $1 >>$MC_CONTROL_FILE
else
(gunzip -v $1 ; bzip2 -v --repetitive-best $D)||echo tag $1 >>$MC_CONTROL_FILE
fi
shift
done