home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / gnu / nethack-3.1 / sys / unix / nethack.sh < prev    next >
Encoding:
Linux/UNIX/POSIX Shell Script  |  1991-06-12  |  1.1 KB  |  59 lines

  1. #!/bin/sh
  2. #    SCCS Id: @(#)nethack.sh    3.1    90/02/26
  3.  
  4. HACKDIR=/usr/games/lib/nethackdir
  5. HACK=$HACKDIR/nethack
  6. MAXNROFPLAYERS=4
  7.  
  8. # see if we can find the full path name of PAGER, so help files work properly
  9. # assume that if someone sets up a special variable (HACKPAGER) for NetHack,
  10. # it will already be in a form acceptable to NetHack
  11. # ideas from brian@radio.astro.utoronto.ca
  12. if test \( "xxx$PAGER" != xxx \) -a \( "xxx$HACKPAGER" = xxx \)
  13. then
  14.  
  15.     HACKPAGER=$PAGER
  16.  
  17. #    use only the first word of the pager variable
  18. #    this prevents problems when looking for file names with trailing
  19. #    options, but also makes the options unavailable for later use from
  20. #    NetHack
  21.     for i in $HACKPAGER
  22.     do
  23.         HACKPAGER=$i
  24.         break
  25.     done
  26.  
  27.     if test ! -f $HACKPAGER
  28.     then
  29.         IFS=:
  30.         for i in $PATH
  31.         do
  32.             if test -f $i/$HACKPAGER
  33.             then
  34.                 HACKPAGER=$i/$HACKPAGER
  35.                 export HACKPAGER
  36.                 break
  37.             fi
  38.         done
  39.         IFS='     '
  40.     fi
  41.     if test ! -f $HACKPAGER
  42.     then
  43.         echo Cannot find $PAGER -- unsetting PAGER.
  44.         unset HACKPAGER
  45.         unset PAGER
  46.     fi
  47. fi
  48.  
  49.  
  50. cd $HACKDIR
  51. case $1 in
  52.     -s*)
  53.         exec $HACK "$@"
  54.         ;;
  55.     *)
  56.         exec $HACK "$@" $MAXNROFPLAYERS
  57.         ;;
  58. esac
  59.