aboutsummaryrefslogtreecommitdiffstats
path: root/testing/nethack/nethack.bin
diff options
context:
space:
mode:
authorJesse Young <jlyo@jlyo.org>2015-07-26 18:41:26 -0500
committerFrancesco Colista <fcolista@alpinelinux.org>2015-07-28 07:36:17 +0000
commitf35d8b1e5db9b63238f4078be508a46d246c9ab7 (patch)
tree23cf27c6c64af087f0124a7a66cca6ace96c9283 /testing/nethack/nethack.bin
parent0e2ea514281e3204d2d09dcb1c46134428e55b7a (diff)
downloadaports-f35d8b1e5db9b63238f4078be508a46d246c9ab7.tar.bz2
aports-f35d8b1e5db9b63238f4078be508a46d246c9ab7.tar.xz
testing/nethack: new aport
Diffstat (limited to 'testing/nethack/nethack.bin')
-rwxr-xr-xtesting/nethack/nethack.bin74
1 files changed, 74 insertions, 0 deletions
diff --git a/testing/nethack/nethack.bin b/testing/nethack/nethack.bin
new file mode 100755
index 0000000000..272e23f085
--- /dev/null
+++ b/testing/nethack/nethack.bin
@@ -0,0 +1,74 @@
+#!/bin/sh
+
+set -e
+set -u
+
+die () { echo "nethack:" "$@" >&2 ; exit 1 ; }
+
+[ "x${HOME:-}" = x ] && die "\$HOME not set"
+cd "$HOME"
+[ -d .nethack ] || mkdir -p .nethack
+cd .nethack
+[ -f nhdat ] || ln -s /usr/share/nethack/nhdat nhdat
+[ -d save ] || mkdir -p save
+[ -f logfile ] || : > logfile
+[ -f perm ] || : > perm
+[ -f record ] || : > record
+
+HACKDIR="$HOME/.nethack"
+export HACKDIR
+HACK=/usr/lib/nethack/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." >&2
+ unset HACKPAGER
+ unset PAGER
+ fi
+fi
+
+case "x${1:-}" in
+ x-s*) exec "$HACK" "$@" ;;
+ x*) exec "$HACK" "$@" "$MAXNROFPLAYERS" ;;
+esac