Files
nethack/sys/unix/nethack.sh
cohrs 648b1489a4 X11 install
Build and install the NetHack.ad file, and change the nethack.sh to append
the HACKDIR to the XUSERFILESEARCHPATH.  This means users do not have to
do anything special to use the NetHack X11 resources, nor does it require
teaching nethack where the X11 app-defaults directory is.  The change also
updates the X11 and linux doc files in a corresponding way.
2003-08-26 15:11:58 +00:00

69 lines
1.3 KiB
Bash

#!/bin/sh
# SCCS Id: @(#)nethack.sh 3.4 1990/02/26
HACKDIR=/usr/games/lib/nethackdir
export HACKDIR
HACK=$HACKDIR/nethack
MAXNROFPLAYERS=4
# Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
case "x$XUSERFILESEARCHPATH" in
x) XUSERFILESEARCHPATH="$HACKDIR/%N.ad"
;;
*) XUSERFILESEARCHPATH="$XUSERFILESEARCHPATH:$HACKDIR/%N.ad"
;;
esac
export XUSERFILESEARCHPATH
# see if we can find the full path name of PAGER, so help files work properly
# assume that if someone sets up a special variable (HACKPAGER) for NetHack,
# it will already be in a form acceptable to NetHack
# ideas from brian@radio.astro.utoronto.ca
if test \( "xxx$PAGER" != xxx \) -a \( "xxx$HACKPAGER" = xxx \)
then
HACKPAGER=$PAGER
# use only the first word of the pager variable
# this prevents problems when looking for file names with trailing
# options, but also makes the options unavailable for later use from
# NetHack
for i in $HACKPAGER
do
HACKPAGER=$i
break
done
if test ! -f $HACKPAGER
then
IFS=:
for i in $PATH
do
if test -f $i/$HACKPAGER
then
HACKPAGER=$i/$HACKPAGER
export HACKPAGER
break
fi
done
IFS=' '
fi
if test ! -f $HACKPAGER
then
echo Cannot find $PAGER -- unsetting PAGER.
unset HACKPAGER
unset PAGER
fi
fi
cd $HACKDIR
case $1 in
-s*)
exec $HACK "$@"
;;
*)
exec $HACK "$@" $MAXNROFPLAYERS
;;
esac