diff -ru nethack-3.4.2-orig/include/config.h nethack-3.4.2/include/config.h --- nethack-3.4.2-orig/include/config.h Sun Oct 5 17:52:56 2003 +++ nethack-3.4.2/include/config.h Sun Oct 5 17:53:20 2003 @@ -42,10 +42,10 @@ * Define all of those you want supported in your binary. * Some combinations make no sense. See the installation document. */ -#define TTY_GRAPHICS /* good old tty based graphics */ -/* #define X11_GRAPHICS */ /* X11 interface */ +#define TTY_GRAPHICS /* good old tty based graphics */ +#define X11_GRAPHICS /* X11 interface */ /* #define QT_GRAPHICS */ /* Qt interface */ -/* #define GNOME_GRAPHICS */ /* Gnome interface */ +#define GNOME_GRAPHICS /* Gnome interface */ /* #define MSWIN_GRAPHICS */ /* Windows NT, CE, Graphics */ /* @@ -54,6 +54,9 @@ * * tty, X11, mac, amii, BeOS, Qt, Gem, Gnome */ + +/* Matthias Neeracher: X11 looks better than Gnome */ +#define DEFAULT_WINDOW_SYS "X11" /* MAC also means MAC windows */ #ifdef MAC diff -ru nethack-3.4.2-orig/include/system.h nethack-3.4.2/include/system.h --- nethack-3.4.2-orig/include/system.h Sun Oct 5 17:52:56 2003 +++ nethack-3.4.2/include/system.h Sun Oct 5 17:55:44 2003 @@ -80,7 +80,11 @@ E long NDECL(random); # endif # if (!defined(SUNOS4) && !defined(bsdi) && !defined(__FreeBSD__)) || defined(RANDOM) +# if defined(__APPLE__) +E void FDECL(srandom, (unsigned long)); +# else E void FDECL(srandom, (unsigned int)); +# endif # else # if !defined(bsdi) && !defined(__FreeBSD__) E int FDECL(srandom, (unsigned int)); Only in nethack-3.4.2/include: system.h.orig Only in nethack-3.4.2/include: system.h~ diff -ru nethack-3.4.2-orig/include/unixconf.h nethack-3.4.2/include/unixconf.h --- nethack-3.4.2-orig/include/unixconf.h Sun Oct 5 17:52:56 2003 +++ nethack-3.4.2/include/unixconf.h Sun Oct 5 17:57:17 2003 @@ -19,20 +19,20 @@ */ /* define exactly one of the following four choices */ -/* #define BSD 1 */ /* define for 4.n/Free/Open/Net BSD */ +#define BSD 1 /* define for 4.n/Free/Open/Net BSD */ /* also for relatives like SunOS 4.x, DG/UX, and */ /* older versions of Linux */ /* #define ULTRIX */ /* define for Ultrix v3.0 or higher (but not lower) */ /* Use BSD for < v3.0 */ /* "ULTRIX" not to be confused with "ultrix" */ -#define SYSV /* define for System V, Solaris 2.x, newer versions */ +/* #define SYSV */ /* define for System V, Solaris 2.x, newer versions */ /* of Linux */ /* #define HPUX */ /* Hewlett-Packard's Unix, version 6.5 or higher */ /* use SYSV for < v6.5 */ /* define any of the following that are appropriate */ -#define SVR4 /* use in addition to SYSV for System V Release 4 */ +/* #define SVR4 */ /* use in addition to SYSV for System V Release 4 */ /* including Solaris 2+ */ #define NETWORK /* if running on a networked system */ /* e.g. Suns sharing a playground through NFS */ @@ -324,7 +324,7 @@ # undef hc #endif -#if defined(GNOME_GRAPHICS) +#if defined(GNOME_GRAPHICS) && !defined(__APPLE__) #if defined(LINUX) # include # if defined(__NR_getresuid) && defined(__NR_getresgid) /* ie., >= v2.1.44 */ Only in nethack-3.4.2/include: unixconf.h.orig Only in nethack-3.4.2/include: unixconf.h~ diff -ru nethack-3.4.2-orig/src/files.c nethack-3.4.2/src/files.c --- nethack-3.4.2-orig/src/files.c Sun Oct 5 17:52:55 2003 +++ nethack-3.4.2/src/files.c Sun Oct 5 18:29:18 2003 @@ -1551,8 +1551,16 @@ # if defined(__APPLE__) /* try an alternative */ if (envp) { + uid_t saved_uid = geteuid(); + gid_t saved_gid = getegid(); + seteuid(getuid()); + setegid(getgid()); Sprintf(tmp_config, "%s/%s", envp, "Library/Preferences/NetHack Defaults"); - if ((fp = fopenp(tmp_config, "r")) != (FILE *)0) + fp = fopenp(tmp_config, "r"); + seteuid(saved_uid); + setegid(saved_gid); + + if (fp) return(fp); } # endif Only in nethack-3.4.2/src: files.c~ diff -ru nethack-3.4.2-orig/sys/unix/Makefile.src nethack-3.4.2/sys/unix/Makefile.src --- nethack-3.4.2-orig/sys/unix/Makefile.src Sun Oct 5 17:52:57 2003 +++ nethack-3.4.2/sys/unix/Makefile.src Sun Oct 5 17:58:40 2003 @@ -146,13 +146,13 @@ # directories. The ones given below is the usual spot for linux systems. # The paths are for glibconfig.h and gnomesupport.h respectively. # -GNOMEINC=-I/usr/lib/glib/include -I/usr/lib/gnome-libs/include -I../win/gnome +GNOMEINC=`gnome-config --cflags gnome` -I../win/gnome # flags for debugging: # CFLAGS = -g -I../include -CFLAGS = -O -I../include -LFLAGS = +CFLAGS = -g -DDARWIN -DHACKDIR=\"$(HACKDIR)\" -O -I../include -I@PREFIX@/include -I/usr/X11R6/include -no-cpp-precomp +LFLAGS = -L@PREFIX@/lib # The Qt and Be window systems are written in C++, while the rest of # NetHack is standard C. If using Qt, uncomment the LINK line here to get @@ -198,7 +198,7 @@ ../win/gnome/gnworn.c WINGNOMEOBJ = gnaskstr.o gnbind.o gnglyph.o gnmain.o gnmap.o gnmenu.o \ gnmesg.o gnopts.o gnplayer.o gnsignal.o gnstatus.o gntext.o \ - gnyesno.o gnworn.o tile.o + gnyesno.o gnworn.o # # Files for a Gem port WINGEMSRC = ../win/gem/wingem.c ../win/gem/wingem1.c ../win/gem/load_img.c \ @@ -214,8 +214,8 @@ # # -WINSRC = $(WINTTYSRC) -WINOBJ = $(WINTTYOBJ) +WINSRC = $(WINTTYSRC) $(WINGNOMESRC) $(WINX11SRC) +WINOBJ = $(WINTTYOBJ) $(WINGNOMEOBJ) $(WINX11OBJ) # on some systems the termcap library is in -ltermcap or -lcurses # on 386 Xenix, the -ltermlib tputs() seems not to work; use -lcurses instead @@ -230,12 +230,12 @@ # WINTTYLIB = -ltermcap # WINTTYLIB = -lcurses # WINTTYLIB = -lcurses16 -# WINTTYLIB = -lncurses -WINTTYLIB = -ltermlib +WINTTYLIB = -lncurses +# WINTTYLIB = -ltermlib # # libraries for X11 # If USE_XPM is defined in config.h, you will also need -lXpm here. -WINX11LIB = -lXaw -lXmu -lXext -lXt -lX11 +WINX11LIB = -lXaw -lXmu -lXt -lXpm # WINX11LIB = -lXaw -lXmu -lXt -lX11 # WINX11LIB = -lXaw -lXmu -lXext -lXt -lXpm -lX11 -lm # WINX11LIB = -lXaw -lXmu -lXpm -lXext -lXt -lX11 -lSM -lICE -lm # BSD/OS 2.0 @@ -247,7 +247,7 @@ WINKDELIB = -lkdecore -lkdeui -lXext # # libraries for Gnome -WINGNOMELIB = -lgnomeui -lgnome -lart_lgpl -lgtk -lgdk -lpopt +WINGNOMELIB = `gnome-config --libs gnome gnomeui` -lgnugetopt # # libraries for Gem port WINGEMLIB = -le_gem -lgem @@ -255,7 +255,7 @@ # libraries for BeOS WINBELIB = -lbe -WINLIB = $(WINTTYLIB) +WINLIB = $(WINTTYLIB) $(WINGNOMELIB) $(WINX11LIB) # any other strange libraries your system needs (for Sysunix only -- the more # specialized targets should already be right) @@ -631,6 +631,8 @@ winval.o: ../win/X11/winval.c $(HACK_H) ../include/winX.h $(CC) $(CFLAGS) -c ../win/X11/winval.c tile.o: tile.c $(HACK_H) +getopt.o: ../win/gnome/getopt.c ../win/gnome/getopt.h + $(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/getopt.c gnaskstr.o: ../win/gnome/gnaskstr.c ../win/gnome/gnaskstr.h \ ../win/gnome/gnmain.h $(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnaskstr.c Only in nethack-3.4.2/sys/unix: Makefile.src.orig Only in nethack-3.4.2/sys/unix: Makefile.src~ diff -ru nethack-3.4.2-orig/sys/unix/Makefile.top nethack-3.4.2/sys/unix/Makefile.top --- nethack-3.4.2-orig/sys/unix/Makefile.top Sun Oct 5 17:52:57 2003 +++ nethack-3.4.2/sys/unix/Makefile.top Sun Oct 5 17:59:35 2003 @@ -37,10 +37,11 @@ # instructions) GAMEDIR = $(PREFIX)/games/lib/$(GAME)dir VARDIR = $(GAMEDIR) +HACKDIR = $(GAMEDIR) SHELLDIR = $(PREFIX)/games # per discussion in Install.X11 and Install.Qt -VARDATND = +# VARDATND = # VARDATND = x11tiles NetHack.ad pet_mark.xbm # VARDATND = x11tiles NetHack.ad pet_mark.xbm rip.xpm # for Atari/Gem @@ -48,7 +49,7 @@ # for BeOS # VARDATND = beostiles # for Gnome -# VARDATND = x11tiles pet_mark.xbm rip.xpm mapbg.xpm +VARDATND = x11tiles pet_mark.xbm rip.xpm mapbg.xpm VARDATD = data oracles options quest.dat rumors VARDAT = $(VARDATD) $(VARDATND) @@ -186,7 +187,7 @@ cp src/$(GAME) $(GAMEDIR) cp util/recover $(GAMEDIR) -rm -f $(SHELLDIR)/$(GAME) - sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \ + sed -e 's;/usr/games/lib/nethackdir;$(HACKDIR);' \ -e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \ < sys/unix/nethack.sh \ > $(SHELLDIR)/$(GAME) Only in nethack-3.4.2/sys/unix: Makefile.top.orig Only in nethack-3.4.2/sys/unix: Makefile.top~ diff -ru nethack-3.4.2-orig/sys/unix/unixmain.c nethack-3.4.2/sys/unix/unixmain.c --- nethack-3.4.2-orig/sys/unix/unixmain.c Sun Oct 5 17:52:57 2003 +++ nethack-3.4.2/sys/unix/unixmain.c Sun Oct 5 17:53:20 2003 @@ -88,7 +88,7 @@ hackpid = getpid(); (void) umask(0777 & ~FCMASK); - choose_windows(DEFAULT_WINDOW_SYS); + choose_windows(getenv("DISPLAY")?DEFAULT_WINDOW_SYS:"tty"); #ifdef CHDIR /* otherwise no chdir() */ /* diff -ru nethack-3.4.2-orig/sys/unix/unixres.c nethack-3.4.2/sys/unix/unixres.c --- nethack-3.4.2-orig/sys/unix/unixres.c Sun Oct 5 17:52:57 2003 +++ nethack-3.4.2/sys/unix/unixres.c Sun Oct 5 17:53:20 2003 @@ -16,6 +16,8 @@ #include "config.h" +#include + #ifdef GETRES_SUPPORT # if defined(LINUX) diff -ru nethack-3.4.2-orig/win/gnome/gnmain.c nethack-3.4.2/win/gnome/gnmain.c --- nethack-3.4.2-orig/win/gnome/gnmain.c Sun Oct 5 17:52:57 2003 +++ nethack-3.4.2/win/gnome/gnmain.c Sun Oct 5 17:53:20 2003 @@ -6,8 +6,8 @@ #include "gnsignal.h" #include "gnbind.h" #include "gnopts.h" +#include #include -#include #include #include #include