NHDT->ANH, in most cases
[aNetHack.git] / sys / unix / nethack.sh
blob42f2913a33ed20a5fbaa74bd4b1b5c420ff0b86d
1 #!/bin/sh
2 # NetHack 3.6 nethack.sh $ANH-Date: 1432512789 2015/05/25 00:13:09 $ $ANH-Branch: master $:$ANH-Revision: 1.17 $
4 HACKDIR=/usr/games/lib/nethackdir
5 export HACKDIR
6 HACK=$HACKDIR/nethack
8 # Since Nethack.ad is installed in HACKDIR, add it to XUSERFILESEARCHPATH
9 case "x$XUSERFILESEARCHPATH" in
10 x) XUSERFILESEARCHPATH="$HACKDIR/%N.ad"
12 *) XUSERFILESEARCHPATH="$XUSERFILESEARCHPATH:$HACKDIR/%N.ad"
14 esac
15 export XUSERFILESEARCHPATH
17 # Get font dir added, but only once (and only if there's an xset to be found).
18 test -n "$DISPLAY" -a -e $HACKDIR/fonts.dir && xset p >/dev/null 2>&1 && (
19 xset fp- $HACKDIR >/dev/null 2>&1;
20 xset fp+ $HACKDIR
23 # see if we can find the full path name of PAGER, so help files work properly
24 # assume that if someone sets up a special variable (HACKPAGER) for NetHack,
25 # it will already be in a form acceptable to NetHack
26 # ideas from brian@radio.astro.utoronto.ca
27 if test \( "xxx$PAGER" != xxx \) -a \( "xxx$HACKPAGER" = xxx \)
28 then
30 HACKPAGER=$PAGER
32 # use only the first word of the pager variable
33 # this prevents problems when looking for file names with trailing
34 # options, but also makes the options unavailable for later use from
35 # NetHack
36 for i in $HACKPAGER
38 HACKPAGER=$i
39 break
40 done
42 if test ! -f $HACKPAGER
43 then
44 IFS=:
45 for i in $PATH
47 if test -f $i/$HACKPAGER
48 then
49 HACKPAGER=$i/$HACKPAGER
50 export HACKPAGER
51 break
53 done
54 IFS=' '
56 if test ! -f $HACKPAGER
57 then
58 echo Cannot find $PAGER -- unsetting PAGER.
59 unset HACKPAGER
60 unset PAGER
65 cd $HACKDIR
66 exec $HACK "$@"