From owner-freebsd-ports Fri Jun 28 11:18:02 1996 Return-Path: owner-ports Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id LAA19300 for ports-outgoing; Fri, 28 Jun 1996 11:18:02 -0700 (PDT) Received: from seagull.rtd.com (seagull.rtd.com [198.102.68.2]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id LAA19295 for ; Fri, 28 Jun 1996 11:17:56 -0700 (PDT) Received: (from dgy@localhost) by seagull.rtd.com (8.7.5/1.2) id LAA02052 for freebsd-ports@freefall.cdrom.com; Fri, 28 Jun 1996 11:17:15 -0700 (MST) From: Don Yuniskis Message-Id: <199606281817.LAA02052@seagull.rtd.com> Subject: nethack patch To: freebsd-ports@freefall.FreeBSD.org (FreeBSD ports) Date: Fri, 28 Jun 1996 11:17:15 -0700 (MST) X-Mailer: ELM [version 2.4 PL24] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-ports@FreeBSD.ORG X-Loop: FreeBSD.org Precedence: bulk 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 + #include + #include + #include + #include + #include + #include #else #include #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 */