diff --git a/ChangeLog b/ChangeLog index 05c4f4be4..871757e7b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +1999-09-22 Norbert Warmuth + + * lib/mc.sh.in, mc.csh.in: renamed from mc.sh resp. mc.csh. Adapt + path to the mc binary according to @prefix@. + + * lib/Makefile.in (srcdir): mc.sh and mc.csh are now created by + configure. Install mc.sh and mc.csh in $(suppbindir). + + * doc/mc.1.in, mc.sgml: Updated the mc function definition for bash + and zsh. Suggest to source mc.sh or mc.csh instead of adding verbatim + copies of the included function definitions. + + * mcfn_install.in: Comment out definitions of the mc functions. Source + mc.sh instead of adding an outdated mc function definition. + + * configure.in: output mc.sh and mc.csh + 1999-09-20 Federico Mena Quintero * lib/startup.links: Changed the news link to Gnotices diff --git a/configure.in b/configure.in index 390caa571..d38849903 100644 --- a/configure.in +++ b/configure.in @@ -1273,6 +1273,8 @@ icons/Makefile lib/mc.ext lib/mc-gnome.ext +lib/mc.sh +lib/mc.csh mcfn_install vfs/extfs/ftplist vfs/extfs/uzip vfs/extfs/uzoo vfs/extfs/lslR vfs/extfs/ulha diff --git a/doc/mc.1.in b/doc/mc.1.in index 4eb5927da..00b675ead 100644 --- a/doc/mc.1.in +++ b/doc/mc.1.in @@ -53,13 +53,21 @@ directory; this, along with the shell function below, will allow you to browse through your directories and automatically move to the last directory you were in (thanks to Torben Fjerdingstad and Sergey for contributing this function and the code which implements this option). + +Please don't add verbatim copies of the function definitions below. Source the +files @prefix@/lib/mc/bin/mc.sh (bash and zsh users) respectively +@prefix@/lib/mc/bin/mc.csh (tcsh users) instead. This way you will not +need to change your profiles if the function definitions are improved, +provided that you don't compile MC with a different prefix. .nf bash and zsh users: mc () { - MC=/tmp/mc$$-"$RANDOM" + mkdir -p ~/.mc/tmp 2> /dev/null + chmod 700 ~/.mc/tmp + MC=~/.mc/tmp/mc-$$ @prefix@/bin/mc -P "$@" > "$MC" cd "`cat $MC`" rm "$MC" @@ -72,7 +80,8 @@ alias mc 'setenv MC `@prefix@/bin/mc -P \!*`; cd $MC; unsetenv MC' .TP I know the bash function could be shorter for zsh and bash but the backquotes on bash won't accept your suspension the program with -C-z. +C-z. The temporary file is created in the private directory ~/.mc/tmp +in order to avoid symlink attachs in a world writable /tmp. .TP .I "\-s" Turns on the slow terminal mode, in this mode the program will not diff --git a/doc/mc.sgml b/doc/mc.sgml index b54c42c3b..765212814 100644 --- a/doc/mc.sgml +++ b/doc/mc.sgml @@ -78,13 +78,20 @@ you were in (thanks to Torben Fjerdingstad and Sergey for contributing this function and the code which implements this option). +Please don't add verbatim copies of the function definitions below. Source the +files @prefix@/lib/mc/bin/mc.sh (bash and zsh users) respectively +@prefix@/lib/mc/bin/mc.csh (tcsh users) instead. This way you will not +need to change your profiles if the function definitions are improved, +provided that you don't compile MC with a different prefix. bash and zsh users: mc () { - MC=/tmp/mc$$-"$RANDOM" + mkdir -p ~/.mc/tmp 2> /dev/null + chmod 700 ~/.mc/tmp + MC=~/.mc/tmp/mc$$-"$RANDOM" @prefix@/bin/mc -P "$@" > "$MC" cd "`cat $MC`" rm "$MC" @@ -97,7 +104,8 @@ alias mc 'setenv MC `@prefix@/bin/mc -P \!*`; cd $MC; unsetenv MC' I know the bash function could be shorter for zsh and bash but the backquotes on bash won't accept your suspension the program with -C-z. +C-z. The temporary file is created in the private directory ~/.mc/tmp +in order to avoid symlink attachs in a world writable /tmp. /dev/null chmod 700 ~/.mc/tmp - MC=~/.mc/tmp/mc$$-"$RANDOM" - /usr/bin/mc -P "$@" > "$MC" + MC=~/.mc/tmp/mc-$$ + @prefix@/bin/mc -P "$@" > "$MC" cd "`cat $MC`" rm "$MC" unset MC; diff --git a/mcfn_install.in b/mcfn_install.in index f6f359330..9cf99c7d1 100644 --- a/mcfn_install.in +++ b/mcfn_install.in @@ -1,6 +1,39 @@ #!/bin/sh # + prefix=@prefix@ +suppbindir=@prefix@/lib/mc/bin + +do_compat_replace () { + cp $1 $1.orig + if test "$?" != "0"; then + echo "Command \`cp $1 $1.orig' failed. File $1 not changed!" + return 1 + fi + sed '/^mc ()/ { + # Add comment + i\ +#Commented out by mc_fninstall. Source @prefix@/lib/mc/bin/mc.sh instead. +} + +/^mc ()[^}]*$/,/}[; ]*$/{ + # Function definition over several lines + s/^\(.*\)$/#\1/g +} + +/^mc ().*}.*$/{ + # Function definition on one line + s/^\(.*\)$/#\1/g +}' < $1.orig > $1 + + echo >> $1 + echo ". $suppbindir/mc.sh" >> $1 + echo "" + echo "I commented out the mc () function definitions in $1 and added" + echo "\`. $suppbindir/mc.sh'. Your previous profile has been saved as" + echo "$1.orig." +} + if test -n `echo $prefix | grep prefix`; then prefix=/usr/local fi @@ -22,6 +55,40 @@ if test -f $PROFILE; then B=`grep "mc ()" $BASHRC` fi fi + + if test -n "$A" -o -n "$B"; then + if test -n "$B"; then + echo "While examining your $PROFILE and $BASHRC," + else + echo "While examining your $PROFILE," + fi + echo "I've found that you have a probably outdated mc () function definition" + echo "there. Do you want to replace this function definition with " + echo " . $suppbindir/mc.sh" + read rep + case $rep in + [Yy]*) ;; + *) exit ;; + esac + if test -n "$A"; then + do_compat_replace $PROFILE + fi + if test -n "$B"; then + do_compat_replace $BASHRC + fi + + exit 0 + fi + unset -f do_compat_replace + + # This doesn't handle the case that $prefix changed + A=`grep "/mc.sh" $PROFILE` + B= + if test -n "$BASHRC"; then + if test -f $BASHRC; then + B=`grep "/mc.sh" $BASHRC` + fi + fi if test -n "$A"; then : else @@ -36,14 +103,15 @@ if test -f $PROFILE; then else echo "While examining your $PROFILE," fi - echo "I've found that you have no mc () function defined there." - echo "This function enables a feature of mc(1) that when you leave mc(1)," - echo "you return to a directory where you were in mc just before exiting" - echo "and not to the directory you've started mc from." + echo "I've found that you do not source $suppbindir/mc.sh there." + echo "This shell script defines a function which enables a feature of mc(1)" + echo "that when you leave mc(1), you return to a directory where you were" + echo "in mc just before exiting and not to the directory you've started mc" + echo "from." echo "Would you like to append" - echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };' + echo "test -f $suppbindir/mc.sh && . $suppbindir/mc.sh" if test -n "$BASHRC"; then - echo "function to your (p) $PROFILE (mc function will be active in your login shells)" + echo "to your (p) $PROFILE (mc function will be active in your login shells)" echo -n "or to your (b) $BASHRC (in every bash instance) or (n) no? [p|b|n] " else echo -n "function to your $PROFILE? [y|n] " @@ -55,11 +123,12 @@ if test -f $PROFILE; then INITFILE=$PROFILE fi case $rep in - [Nn]*) exit ;; + [Yy]*) ;; [Pp]*) INITFILE=$PROFILE ;; + *) exit 1;; esac echo >>$INITFILE - echo 'mc () { MC=`'$prefix'/bin/mc -P "$@"`; [ -n "$MC" ] && cd "$MC"; unset MC };' >>$INITFILE + echo 'test -f $suppbindir/mc.sh && . $suppbindir/mc.sh' >>$INITFILE echo "mc () function appended to your $INITFILE" fi fi diff --git a/vfs/ChangeLog b/vfs/ChangeLog index b402b72bc..757ca0666 100644 --- a/vfs/ChangeLog +++ b/vfs/ChangeLog @@ -1,3 +1,8 @@ +1999-09-22 Bjorn Eriksson + + * extfs/uzip.in: Better handling of zip-archives that contain files + which contain spaces. + 1999-09-19 Norbert Warmuth * ftpfs.c (ftpfs_set_debug), vfs.h: added const qualifier. diff --git a/vfs/extfs/uzip.in b/vfs/extfs/uzip.in index 28aaf5f2c..8a7d88c3f 100644 --- a/vfs/extfs/uzip.in +++ b/vfs/extfs/uzip.in @@ -67,7 +67,7 @@ if ($8 ~ /^\^/) if ($8 ~ /\/$/) printf "drwxr-xr-x 1 %-8d %-8d %8d %s %s %s\n", uid, 0, $1, $5, $6, $8 else - printf "-rw-r--r-- 1 %-8d %-8d %8d %s %s %s\n", uid, 0, $1, $5, $6, $8 + printf "-rw-r--r-- 1 %-8d %-8d %8d %s %s %s\n", uid, 0, $1, $5, $6, substr($0, index($0, $7) + length($7 " ") }' 2>/dev/null fi }