diff -Naurd ../nethack-3.4.0/sys/unix/Install.unx ./sys/unix/Install.unx
--- ../nethack-3.4.0/sys/unix/Install.unx Wed Mar 20 23:43:53 2002
+++ ./sys/unix/Install.unx Mon Feb 24 15:25:05 2003
@@ -77,10 +77,10 @@
     files the main executable will use.  Then become root if necessary and
     type 'make install'.  Everything should now be set.
 
-8.  Read doc/recover.man or doc/recover.txt, and think about whether and
-    how you want to install the recover program.  If you decide to install
-    it, type 'make recover' in the util directory and then install recover
-    by hand in your desired manner.
+8.  Read doc/recover.man or doc/recover.txt to learn how to use the recover
+    program.  The recover program can be used in case of a crash to recover
+    a game that was in progress.  The recover command is installed in the
+    GAMEDIR by default.
 
 Notes:
 
diff -Naurd ../nethack-3.4.0/sys/unix/Makefile.dat ./sys/unix/Makefile.dat
--- ../nethack-3.4.0/sys/unix/Makefile.dat Wed Mar 20 23:43:53 2002
+++ ./sys/unix/Makefile.dat Mon Feb 24 15:25:05 2003
@@ -24,6 +24,9 @@
 ../util/tile2beos:
 	(cd ../util ; make tile2beos)
 
+../util/tile2bmp:
+	(cd ../util ; make tile2bmp)
+
 x11tiles: ../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
 				../win/share/other.txt
 	../util/tile2x11 ../win/share/monsters.txt ../win/share/objects.txt \
@@ -34,6 +37,10 @@
 	../util/tile2beos ../win/share/monsters.txt ../win/share/objects.txt \
 				../win/share/other.txt
 
+nhtiles.bmp: ../util/tile2bmp ../win/share/monsters.txt ../win/share/objects.txt \
+				../win/share/other.txt
+	../util/tile2bmp $@
+
 pet_mark.xbm: ../win/X11/pet_mark.xbm
 	cp ../win/X11/pet_mark.xbm pet_mark.xbm
 
@@ -46,6 +53,12 @@
 nhsplash.xpm: ../win/Qt/nhsplash.xpm
 	cp ../win/Qt/nhsplash.xpm nhsplash.xpm
 
+nethack.icns: ../win/Qt/nhicns.uu
+	$(UUDECODE) ../win/Qt/nhicns.uu
+
+Info.plist: ../win/Qt/Info.pli
+	cp ../win/Qt/Info.pli Info.plist
+
 ../util/tile2img.ttp:
 	(cd ../util ; make tile2img.ttp)
 
diff -Naurd ../nethack-3.4.0/sys/unix/Makefile.src ./sys/unix/Makefile.src
--- ../nethack-3.4.0/sys/unix/Makefile.src Wed Mar 20 23:43:54 2002
+++ ./sys/unix/Makefile.src Mon Feb 24 15:25:05 2003
@@ -184,10 +184,11 @@
 	../win/gnome/gnglyph.c ../win/gnome/gnmain.c ../win/gnome/gnmap.c \
 	../win/gnome/gnmenu.c ../win/gnome/gnmesg.c ../win/gnome/gnopts.c \
 	../win/gnome/gnplayer.c ../win/gnome/gnsignal.c \
-	../win/gnome/gnstatus.c ../win/gnome/gntext.c ../win/gnome/gnyesno.c
+	../win/gnome/gnstatus.c ../win/gnome/gntext.c ../win/gnome/gnyesno.c \
+	../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 tile.o
+	gnyesno.o gnworn.o tile.o
 #
 # Files for a Gem port
 WINGEMSRC = ../win/gem/wingem.c ../win/gem/wingem1.c ../win/gem/load_img.c \
@@ -656,17 +657,20 @@
 gntext.o: ../win/gnome/gntext.c ../win/gnome/gntext.h ../win/gnome/gnmain.h \
 		../win/gnome/gn_rip.h
 	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gntext.c
+gnworn.o: ../win/gnome/gnworn.c ../win/gnome/gnworn.h ../win/gnome/gnglyph.h \
+		../win/gnome/gnsignal.h ../win/gnome/gnomeprv.h
+	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnworn.c
 gnyesno.o: ../win/gnome/gnyesno.c ../win/gnome/gnbind.h ../win/gnome/gnyesno.h
 	$(CC) $(CFLAGS) $(GNOMEINC) -c ../win/gnome/gnyesno.c
 wingem.o: ../win/gem/wingem.c $(HACK_H) ../include/func_tab.h ../include/dlb.h \
 		../include/patchlevel.h ../include/wingem.h
 	$(CC) $(CFLAGS) -c ../win/gem/wingem.c
 wingem1.o: ../win/gem/wingem1.c ../include/gem_rsc.h ../include/load_img.h \
-		../include/wintype.h ../include/wingem.h
+		../include/gr_rect.h ../include/wintype.h ../include/wingem.h
 	$(CC) $(CFLAGS) -c ../win/gem/wingem1.c
 load_img.o: ../win/gem/load_img.c ../include/load_img.h
 	$(CC) $(CFLAGS) -c ../win/gem/load_img.c
-gr_rect.o: ../win/gem/gr_rect.c
+gr_rect.o: ../win/gem/gr_rect.c ../include/gr_rect.h
 	$(CC) $(CFLAGS) -c ../win/gem/gr_rect.c
 tile.o: tile.c $(HACK_H)
 qt_win.o: ../win/Qt/qt_win.cpp $(HACK_H) ../include/func_tab.h \
@@ -684,7 +688,7 @@
 alloc.o: alloc.c $(CONFIG_H)
 apply.o: apply.c $(HACK_H) ../include/edog.h
 artifact.o: artifact.c $(HACK_H) ../include/artifact.h ../include/artilist.h
-attrib.o: attrib.c $(HACK_H) ../include/artifact.h
+attrib.o: attrib.c $(HACK_H)
 ball.o: ball.c $(HACK_H)
 bones.o: bones.c $(HACK_H) ../include/lev.h
 botl.o: botl.c $(HACK_H)
@@ -714,7 +718,7 @@
 fountain.o: fountain.c $(HACK_H)
 hack.o: hack.c $(HACK_H)
 hacklib.o: hacklib.c $(HACK_H)
-invent.o: invent.c $(HACK_H) ../include/artifact.h
+invent.o: invent.c $(HACK_H)
 light.o: light.c $(HACK_H) ../include/lev.h
 lock.o: lock.c $(HACK_H)
 mail.o: mail.c $(HACK_H) ../include/mail.h
@@ -728,11 +732,12 @@
 mklev.o: mklev.c $(HACK_H)
 mkmap.o: mkmap.c $(HACK_H) ../include/sp_lev.h
 mkmaze.o: mkmaze.c $(HACK_H) ../include/sp_lev.h ../include/lev.h
-mkobj.o: mkobj.c $(HACK_H) ../include/artifact.h
+mkobj.o: mkobj.c $(HACK_H)
 mkroom.o: mkroom.c $(HACK_H)
 mon.o: mon.c $(HACK_H) ../include/mfndpos.h ../include/edog.h
 mondata.o: mondata.c $(HACK_H) ../include/eshk.h ../include/epri.h
-monmove.o: monmove.c $(HACK_H) ../include/mfndpos.h ../include/artifact.h
+monmove.o: monmove.c $(HACK_H) ../include/mfndpos.h ../include/artifact.h \
+		../include/epri.h
 monst.o: monst.c $(CONFIG_H) ../include/permonst.h ../include/align.h \
 		../include/monattk.h ../include/monflag.h ../include/monsym.h \
 		../include/dungeon.h ../include/eshk.h ../include/vault.h \
@@ -788,7 +793,7 @@
 were.o: were.c $(HACK_H)
 wield.o: wield.c $(HACK_H)
 windows.o: windows.c $(HACK_H) ../include/wingem.h ../include/winGnome.h
-wizard.o: wizard.c $(HACK_H) ../include/qtext.h
+wizard.o: wizard.c $(HACK_H) ../include/qtext.h ../include/epri.h
 worm.o: worm.c $(HACK_H) ../include/lev.h
 worn.o: worn.c $(HACK_H)
 write.o: write.c $(HACK_H)
diff -Naurd ../nethack-3.4.0/sys/unix/Makefile.top ./sys/unix/Makefile.top
--- ../nethack-3.4.0/sys/unix/Makefile.top Wed Mar 20 23:43:54 2002
+++ ./sys/unix/Makefile.top Mon Feb 24 15:25:05 2003
@@ -87,7 +87,7 @@
 $(GAME):
 	( cd src ; $(MAKE) )
 
-all:	$(GAME) Guidebook $(VARDAT) dungeon spec_levs check-dlb
+all:	$(GAME) recover Guidebook $(VARDAT) dungeon spec_levs check-dlb
 	@echo "Done."
 
 # Note: many of the dependencies below are here to allow parallel make
@@ -124,6 +124,9 @@
 	( cd util ; $(MAKE) dgn_comp )
 	( cd dat ; $(MAKE) dungeon )
 
+nhtiles.bmp: $(GAME)
+	( cd dat ; $(MAKE) nhtiles.bmp )
+
 x11tiles: $(GAME)
 	( cd util ; $(MAKE) tile2x11 )
 	( cd dat ; $(MAKE) x11tiles )
@@ -164,6 +167,10 @@
 	( cd util ; $(MAKE) dlb )
 	( cd dat ; ../util/dlb cf nhdat $(DATDLB) )
 
+# recover can be used when INSURANCE is defined in include/config.h
+# and the checkpoint option is true
+recover: $(GAME)
+	( cd util ; $(MAKE) recover )
 
 dofiles:
 	target=`sed -n					\
@@ -174,15 +181,17 @@
 	  	-e '$$s/.*/nodlb/p' < dat/options` ;	\
 	$(MAKE) dofiles-$${target-nodlb}
 	cp src/$(GAME) $(GAMEDIR)
+	cp util/recover $(GAMEDIR)
 	-rm -f $(SHELLDIR)/$(GAME)
 	sed -e 's;/usr/games/lib/nethackdir;$(GAMEDIR);' \
 		-e 's;HACKDIR/nethack;HACKDIR/$(GAME);' \
 		< sys/unix/nethack.sh \
 		> $(SHELLDIR)/$(GAME)
 # set up their permissions
-	-( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(GAME) ; \
-			$(CHGRP) $(GAMEGRP) $(GAME) )
+	-( cd $(GAMEDIR) ; $(CHOWN) $(GAMEUID) $(GAME) recover ; \
+			$(CHGRP) $(GAMEGRP) $(GAME) recover )
 	chmod $(GAMEPERM) $(GAMEDIR)/$(GAME)
+	chmod $(EXEPERM) $(GAMEDIR)/recover
 	-$(CHOWN) $(GAMEUID) $(SHELLDIR)/$(GAME)
 	$(CHGRP) $(GAMEGRP) $(SHELLDIR)/$(GAME)
 	chmod $(EXEPERM) $(SHELLDIR)/$(GAME)
@@ -202,7 +211,7 @@
 			$(CHGRP) $(GAMEGRP) $(DAT) ; \
 			chmod $(FILEPERM) $(DAT) )
 
-update: $(GAME) $(VARDAT) dungeon spec_levs
+update: $(GAME) recover $(VARDAT) dungeon spec_levs
 #	(don't yank the old version out from under people who're playing it)
 	-mv $(GAMEDIR)/$(GAME) $(GAMEDIR)/$(GAME).old
 #	quest.dat is also kept open and has the same problems over NFS
@@ -218,7 +227,7 @@
 # and a reminder
 	@echo You may also want to install the man pages via the doc Makefile.
 
-install: $(GAME) $(VARDAT) dungeon spec_levs
+install: $(GAME) recover $(VARDAT) dungeon spec_levs
 # set up the directories
 # not all mkdirs have -p; those that don't will create a -p directory
 	-mkdir -p $(SHELLDIR)
diff -Naurd ../nethack-3.4.0/sys/unix/Makefile.utl ./sys/unix/Makefile.utl
--- ../nethack-3.4.0/sys/unix/Makefile.utl Wed Mar 20 23:43:54 2002
+++ ./sys/unix/Makefile.utl Mon Feb 24 15:25:05 2003
@@ -94,6 +94,10 @@
 
 LIBS =
  
+# If you are cross-compiling, you must use this:
+#OBJDIR = .
+# otherwise, you can save a little bit of disk space with this:
+OBJDIR = ../src
 
 # yacc/lex programs to use to generate *_comp.h, *_lex.c, and *_yacc.c.
 # if, instead of yacc/lex you have bison/flex, comment/uncomment the following.
@@ -132,13 +136,13 @@
 
 # files that define all monsters and objects
 CMONOBJ = ../src/monst.c ../src/objects.c
-OMONOBJ = ../src/monst.o ../src/objects.o
+OMONOBJ = $(OBJDIR)/monst.o $(OBJDIR)/objects.o
 # files that provide access to NetHack's names
 CNAMING = ../src/drawing.c ../src/decl.c $(CMONOBJ)
-ONAMING = ../src/drawing.o ../src/decl.o $(OMONOBJ)
+ONAMING = $(OBJDIR)/drawing.o $(OBJDIR)/decl.o $(OMONOBJ)
 # dynamic memory allocation
 CALLOC = ../src/alloc.c panic.c
-OALLOC = ../src/alloc.o panic.o
+OALLOC = $(OBJDIR)/alloc.o panic.o
 
 # object files for makedefs
 MAKEOBJS = makedefs.o $(OMONOBJ)
@@ -153,7 +157,7 @@
 RECOVOBJS = recover.o
 
 # object files for the data librarian
-DLBOBJS = dlb_main.o ../src/dlb.o $(OALLOC)
+DLBOBJS = dlb_main.o $(OBJDIR)/dlb.o $(OALLOC)
 
 # flags for creating distribution versions of sys/share/*_lex.c, using
 # a more portable flex skeleton, which is not included in the distribution.
@@ -304,8 +308,12 @@
 tile2img.ttp: tile2img.o bitmfile.o $(TEXT_IO)
 	$(CC) $(LFLAGS) -o tile2img.ttp tile2img.o bitmfile.o $(TEXT_IO) $(LIBS)
 
+tile2bmp: tile2bmp.o $(TEXT_IO)
+	$(CC) $(LFLAGS) -o tile2bmp tile2bmp.o $(TEXT_IO)
+
 xpm2img.ttp: xpm2img.o bitmfile.o
 	$(CC) $(LFLAGS) -o xpm2img.ttp xpm2img.o bitmfile.o $(LIBS)
+
 tile2beos: tile2beos.o $(TEXT_IO)
 	$(CC) $(LFLAGS) -o tile2beos tile2beos.o $(TEXT_IO) -lbe
 
@@ -355,18 +363,18 @@
 
 # make sure object files from src are available when needed
 #
-../src/alloc.o: ../src/alloc.c $(CONFIG_H)
-	@( cd ../src ; $(MAKE) alloc.o )
-../src/drawing.o: ../src/drawing.c $(CONFIG_H)
-	@( cd ../src ; $(MAKE) drawing.o )
-../src/decl.o: ../src/decl.c $(CONFIG_H)
-	@( cd ../src ; $(MAKE) decl.o )
-../src/monst.o: ../src/monst.c $(CONFIG_H)
-	@( cd ../src ; $(MAKE) monst.o )
-../src/objects.o: ../src/objects.c $(CONFIG_H)
-	@( cd ../src ; $(MAKE) objects.o )
-../src/dlb.o: ../src/dlb.c $(HACK_H) ../include/dlb.h
-	@( cd ../src ; $(MAKE) dlb.o )
+$(OBJDIR)/alloc.o: ../src/alloc.c $(CONFIG_H)
+	$(CC) $(CFLAGS) -c ../src/alloc.c
+$(OBJDIR)/drawing.o: ../src/drawing.c $(CONFIG_H)
+	$(CC) $(CFLAGS) -c ../src/drawing.c
+$(OBJDIR)/decl.o: ../src/decl.c $(CONFIG_H)
+	$(CC) $(CFLAGS) -c ../src/decl.c
+$(OBJDIR)/monst.o: ../src/monst.c $(CONFIG_H)
+	$(CC) $(CFLAGS) -c ../src/monst.c
+$(OBJDIR)/objects.o: ../src/objects.c $(CONFIG_H)
+	$(CC) $(CFLAGS) -c ../src/objects.c
+$(OBJDIR)/dlb.o: ../src/dlb.c $(HACK_H) ../include/dlb.h
+	$(CC) $(CFLAGS) -c ../src/dlb.c
 
 # make sure hack.h dependencies get transitive information
 $(HACK_H): $(CONFIG_H)
@@ -386,3 +394,7 @@
 	-rm -f ../include/tile.h
 	-rm -f makedefs lev_comp dgn_comp recover dlb
 	-rm -f gif2txt txt2ppm tile2x11 tile2img.ttp xpm2img.ttp tilemap
+
+tileedit: tileedit.cpp $(TEXT_IO)
+	$(QTDIR)/bin/moc -o tileedit.moc tileedit.h
+	$(CC) -o tileedit -I../include -I$(QTDIR)/include -L$(QTDIR)/lib tileedit.cpp $(TEXT_IO) -lqt
diff -Naurd ../nethack-3.4.0/sys/unix/README.linux ./sys/unix/README.linux
--- ../nethack-3.4.0/sys/unix/README.linux Wed Mar 20 23:43:54 2002
+++ ./sys/unix/README.linux Mon Feb 24 15:25:05 2003
@@ -17,9 +17,9 @@
 gunzip and untar the package, preserving permissions, from / to put the
 NetHack files in /usr/games/nethack and /usr/games/lib/nethackdir.
 
-(If you have old record and logfile entries from a previous NetHack
-version, you might want to save copies before they get overwritten by the
-new empty files; old saved games and bones files won't work with 3.4.0).
+(If you have old record and logfile entries from a previous NetHack version,
+you might want to save copies before they get overwritten by the new empty
+files; old saved games and bones files from 3.4.0 will work with 3.4.1).
 
 In addition to data files for running the game, you will find other useful
 things in /usr/games/lib/nethackdir (such as a copy of this README :-).
@@ -54,12 +54,12 @@
 
 Steps used to build this binary release
 
-System:  egcs-1.1.2, XFree86-3.3.6, ncurses-5.0, glibc-2.1.3
+System:  gcc-3.2, XFree86-libs-4.2.0, ncurses-5.2, glibc-2.2.93
 
 0.  Makefile.top: GAMEGRP = games
-		  GAMEPERM = 02775
+		  GAMEPERM = 02755
 		  FILEPERM = 0664
-		  EXEPERM = 0775
+		  EXEPERM = 0755
 		  DIRPERM = 0775
 		  VARDATND = x11tiles pet_mark.xbm rip.xpm
 
@@ -82,8 +82,7 @@
 4.  unixconf.h: define LINUX
                 define TIMED_DELAY
 
-5.  make all; (cd util; make recover); su; make install;
-    cp util/recover /usr/games/lib/nethackdir/recover
+5.  make all; su; make install
 
 6.  Convert nh10.bdf and ibm.bdf to proper font files and place in
     font path.
diff -Naurd ../nethack-3.4.0/sys/unix/unixmain.c ./sys/unix/unixmain.c
--- ../nethack-3.4.0/sys/unix/unixmain.c Wed Mar 20 23:43:55 2002
+++ ./sys/unix/unixmain.c Mon Feb 24 15:25:05 2003
@@ -456,6 +456,7 @@
 	    fqn_prefix[SAVEPREFIX] = fqn_prefix[SCOREPREFIX];
 	    fqn_prefix[BONESPREFIX] = fqn_prefix[SCOREPREFIX];
 	    fqn_prefix[LOCKPREFIX] = fqn_prefix[SCOREPREFIX];
+	    fqn_prefix[TROUBLEPREFIX] = fqn_prefix[SCOREPREFIX];
 # endif
 	    check_recordfile(dir);
 	}
diff -Naurd ../nethack-3.4.0/sys/unix/unixres.c ./sys/unix/unixres.c
--- ../nethack-3.4.0/sys/unix/unixres.c Wed Mar 20 23:43:55 2002
+++ ./sys/unix/unixres.c Mon Feb 24 15:25:05 2003
@@ -19,40 +19,35 @@
 #ifdef GETRES_SUPPORT
 
 # if defined(LINUX)
+#ifdef __GNUC__
+#define _GNU_SOURCE
+#endif
 
-static _syscall3(int, getresuid, unsigned short *, ruid, \
-  unsigned short *, euid, unsigned short *, suid)
-static _syscall3(int, getresgid, unsigned short *, rgid, \
-  unsigned short *, egid, unsigned short *, sgid)
+/* requires dynamic linking with libc */
+#include <dlfcn.h>
 
 static int
 real_getresuid(ruid, euid, suid)
 uid_t *ruid, *euid, *suid;
 {
-    int retval;
-    unsigned short r, e, s;
-    retval = getresuid(&r, &e, &s);
-    if (!retval) {
-	*ruid = r;
-	*euid = e;
-	*suid = s;
-    }
-    return retval;
+    int (*f)(uid_t *, uid_t *, uid_t *); /* getresuid signature */
+
+    f = dlsym(RTLD_NEXT, "getresuid");
+    if (!f) return -1;
+
+    return f(ruid, euid, suid);
 }
 
 static int
 real_getresgid(rgid, egid, sgid)
 gid_t *rgid, *egid, *sgid;
 {
-    int retval;
-    unsigned short r, e, s;
-    retval = getresgid(&r, &e, &s);
-    if (!retval) {
-	*rgid = r;
-	*egid = e;
-	*sgid = s;
-    }
-    return retval;
+    int (*f)(gid_t *, gid_t *, gid_t *); /* getresgid signature */
+
+    f = dlsym(RTLD_NEXT, "getresgid");
+    if (!f) return -1;
+
+    return f(rgid, egid, sgid);
 }
 
 # else
diff -Naurd ../nethack-3.4.0/sys/unix/unixunix.c ./sys/unix/unixunix.c
--- ../nethack-3.4.0/sys/unix/unixunix.c Wed Mar 20 23:43:56 2002
+++ ./sys/unix/unixunix.c Mon Feb 24 15:25:05 2003
@@ -194,24 +194,23 @@
 register char *s;
 {
 	register char *lp;
-#if defined(SYSV) && !defined(AIX_31) && defined(COMPRESS)
-	int i;
-#endif
 
 	while((lp=index(s, '.')) || (lp=index(s, '/')) || (lp=index(s,' ')))
 		*lp = '_';
-#if defined(SYSV) && !defined(AIX_31)
+#if defined(SYSV) && !defined(AIX_31) && !defined(SVR4) && !defined(LINUX)
 	/* avoid problems with 14 character file name limit */
 # ifdef COMPRESS
 	/* leave room for .e from error and .Z from compress appended to
 	 * save files */
+	{
 #  ifdef COMPRESS_EXTENSION
-	i = 12 - strlen(COMPRESS_EXTENSION);
+	    int i = 12 - strlen(COMPRESS_EXTENSION);
 #  else
-	i = 10;		/* should never happen... */
+	    int i = 10;		/* should never happen... */
 #  endif
-	if(strlen(s) > i)
+	    if(strlen(s) > i)
 		s[i] = '\0';
+	}
 # else
 	if(strlen(s) > 11)
 		/* leave room for .nn appended to level files */
