summaryrefslogtreecommitdiff
path: root/Build/source/texk/xdvik/xdvi-sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'Build/source/texk/xdvik/xdvi-sh.in')
-rw-r--r--[-rwxr-xr-x]Build/source/texk/xdvik/xdvi-sh.in17
1 files changed, 12 insertions, 5 deletions
diff --git a/Build/source/texk/xdvik/xdvi-sh.in b/Build/source/texk/xdvik/xdvi-sh.in
index 6f77a666bc9..f9a2d8299fa 100755..100644
--- a/Build/source/texk/xdvik/xdvi-sh.in
+++ b/Build/source/texk/xdvik/xdvi-sh.in
@@ -17,15 +17,22 @@ test -f /bin/bsh && test -z "$RUNNING_BSH" \
&& { RUNNING_BSH=true; export RUNNING_BSH; exec /bin/bsh $0 ${1+"$@"}; }
RUNNING_BSH=
-# -help and -version only work if they are the only options. Therefore,
-# we cannot give the "-name xdvi" parameter in that case.
-# SU: Actually, with current xdvik, they should work in any position; but
-# we may keep this for compatibility with older versions and non-k xdvi.
+# -help and -version only used to work if they were the only options,
+# so the "-name xdvi" parameter wasn't used in that case. With current
+# xdvik, it should work in any case, but we keep this logic for compatibility
+# with older xdvik and plain xdvi versions.
+have_basename=`basename foo/bar 2>&1 | grep -i 'not found'`
+if [ "$have_basename"xxx = "xxx" ]; then
+ BASE_NAME=`basename $0`
+else
+ BASE_NAME=`echo $0 | sed 's!.*/!!'`
+fi
+
case "$#:$1" in
1:-help|1:-version)
NAMEOPT=;;
*)
- NAMEOPT='-name xdvi';;
+ NAMEOPT="-name $BASE_NAME";;
esac
xdviappfile=`kpsewhich -progname=xdvi --format='other text files' XDvi`