From 1881ee2b6474df8fde97fa38da5ece03078e6861 Mon Sep 17 00:00:00 2001 From: jwalz Date: Sat, 5 Jan 2002 21:05:59 +0000 Subject: [PATCH] *** empty log message *** --- sys/unix/nethack.sh | 59 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 sys/unix/nethack.sh diff --git a/sys/unix/nethack.sh b/sys/unix/nethack.sh new file mode 100644 index 000000000..32dd8a454 --- /dev/null +++ b/sys/unix/nethack.sh @@ -0,0 +1,59 @@ +#!/bin/sh +# SCCS Id: @(#)nethack.sh 3.3 90/02/26 + +HACKDIR=/usr/games/lib/nethackdir +export HACKDIR +HACK=$HACKDIR/nethack +MAXNROFPLAYERS=4 + +# 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