Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Jun 1996 11:17:15 -0700 (MST)
From:      Don Yuniskis <dgy@rtd.com>
To:        freebsd-ports@freefall.FreeBSD.org (FreeBSD ports)
Subject:   nethack patch
Message-ID:  <199606281817.LAA02052@seagull.rtd.com>

next in thread | raw e-mail | index | archive | help
Greetings!
      The following diff applies to nethack from the 2.1R distribution.
It adds support for mail notification during game play, /dev/speaker
as a (crummy) audio device, and a few minor presentation tweaks.  I've
manually backed out the X11 changes that I had introduced and believe
the diffs should be OK as editted.
     Could someone please review and commit it?
Thx,
--don
---------------8<--------------8<---------------8<----------------
diff -r --context work/nethack313/include/config.h work.new/nethack313/include/config.h
*** work/nethack313/include/config.h	Fri Jun 28 08:13:10 1996
--- work.new/nethack313/include/config.h	Tue Jun 25 01:24:23 1996
***************
*** 297,303 ****
   * since the user might create files in a directory of his choice.
   * Of course SECURE is meaningful only if HACKDIR is defined.
   */
! /* #define SECURE	/* do setuid(getuid()) after chdir() */
  
  /*
   * If it is desirable to limit the number of people that can play Hack
--- 297,303 ----
   * since the user might create files in a directory of his choice.
   * Of course SECURE is meaningful only if HACKDIR is defined.
   */
! #define SECURE	/* do setuid(getuid()) after chdir() */
  
  /*
   * If it is desirable to limit the number of people that can play Hack
***************
*** 388,396 ****
   * functions that have been macroized.
   */
  
! /*#define VISION_TABLES	/* use vision tables generated at compile time */
  #ifdef VISION_TABLES
! # define BRACES		/* put braces around rows of 2d arrays */
  #else
  # define MACRO_CPATH	/* use clear_path macros instead of functions */
  #endif
--- 388,396 ----
   * functions that have been macroized.
   */
  
! #define VISION_TABLES	/* use vision tables generated at compile time */
  #ifdef VISION_TABLES
! # undef BRACES		/* put braces around rows of 2d arrays */
  #else
  # define MACRO_CPATH	/* use clear_path macros instead of functions */
  #endif
***************
*** 440,446 ****
  #endif
  
  #define EXP_ON_BOTL	/* Show experience on bottom line */
! /* #define SCORE_ON_BOTL	/* added by Gary Erickson (erickson@ucivax) */
  
  #include "global.h"	/* Define everything else according to choices above */
  
--- 440,446 ----
  #endif
  
  #define EXP_ON_BOTL	/* Show experience on bottom line */
! #define SCORE_ON_BOTL	/* added by Gary Erickson (erickson@ucivax) */
  
  #include "global.h"	/* Define everything else according to choices above */
  
diff -r --context work/nethack313/include/unixconf.h work.new/nethack313/include/unixconf.h
*** work/nethack313/include/unixconf.h	Fri Jun 28 08:13:10 1996
--- work.new/nethack313/include/unixconf.h	Mon Jun 24 21:13:40 1996
***************
*** 63,69 ****
  			   is available from your system */
  
  /* see sys/unix/snd86.shr for more information on these */
! /* #define UNIX386MUSIC	/* Play real music through speaker on systems with
  			   music driver installed */
  /* #define VPIX_MUSIC	/* Play real music through speaker on systems with
  			   built-in VPIX support */
--- 63,69 ----
  			   is available from your system */
  
  /* see sys/unix/snd86.shr for more information on these */
! #define UNIX386MUSIC	/* Play real music through speaker on systems with
  			   music driver installed */
  /* #define VPIX_MUSIC	/* Play real music through speaker on systems with
  			   built-in VPIX support */
***************
*** 89,95 ****
   * #define DEF_PAGER	".../mydir/mypager"
   */
  
! 
  
  /*
   * Define PORT_HELP to be the name of the port-specfic help file.
--- 89,95 ----
   * #define DEF_PAGER	".../mydir/mypager"
   */
  
! #define DEF_PAGER "/usr/bin/more"
  
  /*
   * Define PORT_HELP to be the name of the port-specfic help file.
***************
*** 107,113 ****
   * A stat system call is done on the mailbox every MAILCKFREQ moves.
   */
  
! /* #define MAIL			/* Deliver mail during the game */
  
  /* The Andrew Message System does mail a little differently from normal
   * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
--- 107,113 ----
   * A stat system call is done on the mailbox every MAILCKFREQ moves.
   */
  
! #define MAIL			/* Deliver mail during the game */
  
  /* The Andrew Message System does mail a little differently from normal
   * UNIX.  Mail is deposited in the user's own directory in ~/Mailbox
***************
*** 135,141 ****
  #  ifdef AMS
  #define AMS_MAILBOX	"/Mailbox"
  #  else
! #define DEF_MAILREADER	"/usr/ucb/Mail"
  #  endif
  #else
  # if defined(SYSV) || defined(DGUX) || defined(HPUX)
--- 135,141 ----
  #  ifdef AMS
  #define AMS_MAILBOX	"/Mailbox"
  #  else
! #define DEF_MAILREADER	"/usr/bin/mail"
  #  endif
  #else
  # if defined(SYSV) || defined(DGUX) || defined(HPUX)
***************
*** 206,211 ****
--- 206,217 ----
  
  #if defined(BSD) || defined(ULTRIX)
  #include	<sys/time.h>
+ #include	<stdlib.h>
+ #include	<unistd.h>
+ #include	<sys/wait.h>
+ #include	<sys/stat.h>
+ #include	<fcntl.h>
+ #include	<string.h>
  #else
  #include	<time.h>
  #endif
diff -r --context work/nethack313/src/mail.c work.new/nethack313/src/mail.c
*** work/nethack313/src/mail.c	Sun May 16 10:01:52 1993
--- work.new/nethack313/src/mail.c	Sat Jun 22 05:57:59 1996
***************
*** 64,70 ****
  #   define MAILPATH "/dev/null"
  # else
  #  if defined(BSD) || defined(ULTRIX)
! #   define MAILPATH "/usr/spool/mail/"
  #  endif
  #  if defined(SYSV) || defined(HPUX)
  #   define MAILPATH "/usr/mail/"
--- 64,70 ----
  #   define MAILPATH "/dev/null"
  # else
  #  if defined(BSD) || defined(ULTRIX)
! #   define MAILPATH "/var/mail/"
  #  endif
  #  if defined(SYSV) || defined(HPUX)
  #   define MAILPATH "/usr/mail/"
diff -r --context work/nethack313/src/music.c work.new/nethack313/src/music.c
*** work/nethack313/src/music.c	Tue Jul 20 09:27:57 1993
--- work.new/nethack313/src/music.c	Fri Jun 28 07:19:29 1996
***************
*** 575,583 ****
       * difficult given the presence of virtual consoles and other modern
       * UNIX impedimenta...
       */
!     char	*termtype = getenv("TERM");
! 
!      return(!strcmp(termtype, "AT386") || !strcmp(termtype, "xterm"));
  }
  
  static void
--- 575,584 ----
       * difficult given the presence of virtual consoles and other modern
       * UNIX impedimenta...
       */
! #define CONSOLE_DEVICES	"/dev/ttyv"
!     return(isatty(0) && ( (getenv("DISPLAY") && *getenv("DISPLAY")) ||
!            (!strncmp(ttyname(0), CONSOLE_DEVICES, strlen(CONSOLE_DEVICES))) )
!           );
  }
  
  static void
***************
*** 592,599 ****
       * with your nethack distribution.
       */
      int	fd;
  
!     if ((fd = open("/dev/speaker", 1)) != -1)
      {
  	/* send a prefix to modify instrumental `timbre' */
  	switch (instr->otyp)
--- 593,605 ----
       * with your nethack distribution.
       */
      int	fd;
+     uid_t euid = geteuid();
+     gid_t egid = getegid();
+ 
+     seteuid(getuid());
+     setegid(getgid());
  
!     if ((fd = open("/dev/speaker", O_WRONLY, 0777)) != -1)
      {
  	/* send a prefix to modify instrumental `timbre' */
  	switch (instr->otyp)
***************
*** 618,623 ****
--- 624,632 ----
  	(void) write(fd, buf, strlen(buf));
  	(void) close(fd);
      }
+ 
+     seteuid(euid);
+     setegid(egid);
  }
  #endif /* UNIX386MUSIC */
  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199606281817.LAA02052>