* configure.in: Don't substitute mc.sh and mc.csh - it's now

done ...
* lib/Makefile.am: ... here.  Add wrappers for mc to avoid
defining complex shell scripts in functions and aliases.
* lib/mc-wrapper.csh.in: New file - template for the script
that runs mc and changes directory in csh.
* lib/mc-wrapper.sh.in: New file - template for the script
that runs mc and changes directory in sh.
This commit is contained in:
Pavel Roskin 2002-11-01 18:10:20 +00:00
parent e458d50651
commit 83cb1dd047
7 changed files with 63 additions and 22 deletions

View File

@ -1,3 +1,14 @@
2002-11-01 Pavel Roskin <proski@gnu.org>
* configure.in: Don't substitute mc.sh and mc.csh - it's now
done ...
* lib/Makefile.am: ... here. Add wrappers for mc to avoid
defining complex shell scripts in functions and aliases.
* lib/mc-wrapper.csh.in: New file - template for the script
that runs mc and changes directory in csh.
* lib/mc-wrapper.sh.in: New file - template for the script
that runs mc and changes directory in sh.
2002-11-01 Andrew V. Samoilov <sav@bcs.zp.ua>
* doc/mc.1.in (Keys): Document S-<chr>.

View File

@ -577,8 +577,6 @@ pc/Makefile
m4/Makefile
lib/mc.ext
lib/mc.sh
lib/mc.csh
vfs/extfs/deb
vfs/extfs/ftplist

View File

@ -18,11 +18,13 @@ noinst_DATA = \
noinst_SCRIPTS = tdiff
suppbin_SCRIPTS = mc.csh mc.sh
suppbin_SCRIPTS = mc.csh mc.sh mc-wrapper.csh mc-wrapper.sh
ti_DATA = README.xterm linux.ti xterm.ad xterm.ti ansi.ti vt100.ti xterm.tcap
pkgdata_DATA = $(LIBFILES_CONST) $(LIBFILES_ADD) $(LIBFILES_OUT)
CLEANFILES = $(suppbin_SCRIPTS)
# Files processed by configure don't need to be here
EXTRA_DIST = \
$(LIBFILES_CONST) \
@ -31,3 +33,15 @@ EXTRA_DIST = \
$(noinst_SCRIPTS) \
mc.charsets
mc.csh: mc.csh.in
sed "s%@""suppbindir@%$(suppbindir)%" mc.csh.in > mc.csh
mc.sh: mc.sh.in
sed "s%@""suppbindir@%$(suppbindir)%" mc.sh.in > mc.sh
mc-wrapper.csh: mc-wrapper.csh.in
sed "s%@""bindir@%$(bindir)%" mc-wrapper.csh.in > mc-wrapper.csh
mc-wrapper.sh: mc-wrapper.sh.in
sed "s%@""bindir@%$(bindir)%" mc-wrapper.sh.in > mc-wrapper.sh

20
lib/mc-wrapper.csh.in Normal file
View File

@ -0,0 +1,20 @@
#! /bin/csh
if ($?TMPDIR) then
setenv MC_PWD_FILE $TMPDIR/mc-$USER/mc.pwd.$$
else
setenv MC_PWD_FILE /tmp/mc-$USER/mc.pwd.$$
endif
@bindir@/mc -P "$MC_PWD_FILE" $*
if (-r "$MC_PWD_FILE") then
setenv MC_PWD "`cat $MC_PWD_FILE`"
if ( -d "$MC_PWD" ) then
cd "$MC_PWD"
endif
unsetenv MC_PWD
endif
rm -f "$MC_PWD_FILE"
unsetenv MC_PWD_FILE

15
lib/mc-wrapper.sh.in Normal file
View File

@ -0,0 +1,15 @@
#! /bin/sh
MC_PWD_FILE="${TMPDIR-/tmp}/mc-$USER/mc.pwd.$$"
@bindir@/mc -P "$MC_PWD_FILE" "$@"
if test -r "$MC_PWD_FILE"; then
MC_PWD="`cat $MC_PWD_FILE`"
if test -n "$MC_PWD" && test -d "$MC_PWD"; then
cd "$MC_PWD"
fi
unset MC_PWD
fi
rm -f "$MC_PWD_FILE"
unset MC_PWD_FILE

View File

@ -1 +1 @@
alias mc 'setenv MC_PWD_FILE /tmp/mc-$USER/mc.pwd.$$; @prefix@/bin/mc -P "$MC_PWD_FILE" \!*; if -r "$MC_PWD_FILE" cd "`cat $MC_PWD_FILE`"; rm -f "$MC_PWD_FILE"; unsetenv MC_PWD_FILE'
alias mc 'source @suppbindir@/mc-wrapper.csh \!*'

View File

@ -1,18 +1 @@
mc ()
{
MC_PWD_FILE="${TMPDIR-/tmp}/mc-$USER/mc.pwd.$$"
@prefix@/bin/mc -P "$MC_PWD_FILE" "$@"
if test -r "$MC_PWD_FILE"; then
MC_PWD="`cat $MC_PWD_FILE`"
if test -n "$MC_PWD" && test -d "$MC_PWD"; then
cd "$MC_PWD"
fi
fi
rm -f "$MC_PWD_FILE"
unset MC_PWD
unset MC_PWD_FILE
}
if test -n "$BASH_VERSION"; then
export -f mc
fi
alias mc='. @suppbindir@/mc-wrapper.sh "$@"'