NetHack 3.0.10/Patches to compile with DJGPP
Jump to navigation
Jump to search
This post to rec.games.hack is linked from Forum:Where_to_get_compiled_versions_of_NetHack_3.0. Because it contains a patch, a recovered version is provided here.
The post is recovered from the Internet Archive. GitHub has the complete thread.
Issues with applying this patch:
- The patch is reversed. Use "patch -R" to apply.
- config.h does not patch successfully, because the "#define COMPRESS" line doesn't match. You'll probably want to change that anyway.
- The patch applies to a file, "termcap/tgetent.c", that is not explicitly included in the distribution. It is found in the file termcap.arc, which is uuencoded as others/termcap.uu. Even when extracted, the patch does not apply cleanly to this file; it appears to have been made against another version of the termcap library.
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 110b21,34ce57ac7736f335,start
X-Google-Attributes: gid110b21,public
X-Google-ArrivalTime: 1992-10-29 03:58:48 PST
Newsgroups: rec.games.hack
Path: sparky!uunet!utcsri!newsflash.concordia.ca!garrot.DMI.USherb.CA!garrot!bussiere
From: [email address redacted] (Luc Bussieres)
Subject: Patches for compiling with djgpp
Message-ID: <BUSSIERE.92Oct29142042@tohi.DMI.USherb.CA>
Lines: 641
Sender: [email address redacted] (Pour courrier Usenet)
Nntp-Posting-Host: tohi
Organization: Universite de Sherbrooke, Dept. de Mathematiques et
d'Informatique.
Date: Thu, 29 Oct 1992 19:20:50 GMT
I finally build a copy of nethack patch release 10 using djgpp
on the pc. This as build a 386 version of nethack without any memory
restriction.
I have make some small test under my home pc and it seems to
work correctly, I have play couples of time, and everything worked
perfectly. I have then try the same patches on my office pc and there
is a segmentation fault as soon as it try to display the first dunjeon
level. The main difference between both PCs are the display card and
driver. My office PC also has an ethernet card.
I don't have the time right now to test it completly on my
office pc. I'm posting the patches anyway, because somebody ask for
them. It could be a good starting point for porting it completly to
djgpp.
Those patches could be use to patch the original patch release 10 or
the one that has been modified by David.
Good Luck.
*** netpatch/include/config.h Tue Oct 27 11:07:37 1992
--- /home/share/sources/games/nethack3p10/include/config.h Tue Oct 27 11:50:00 1992
***************
*** 14,28 ****
* provides it (no need to change sec#1, vmsconf.h handles it).
*/
! /* #define UNIX */ /* delete if no fork(), exec() available */
#ifdef __MSDOS__ /* Turbo C auto-defines __MSDOS__, MSC defines MSDOS */
! # ifndef MSDOS
! # define MSDOS /* define for MS-DOS (in case compiler doesn't) */
! # endif
! # ifdef __GNUC__
! # define NEARDATA
! # endif
#else
/* #define MSDOS /* define for MS-DOS and most other micros */
/* DO NOT define for AMIGA - MSDOS will be
--- 14,23 ----
* provides it (no need to change sec#1, vmsconf.h handles it).
*/
! #define UNIX /* delete if no fork(), exec() available */
#ifdef __MSDOS__ /* Turbo C auto-defines __MSDOS__, MSC defines MSDOS */
! #define MSDOS /* define for MS-DOS (in case compiler doesn't) */
#else
/* #define MSDOS /* define for MS-DOS and most other micros */
/* DO NOT define for AMIGA - MSDOS will be
***************
*** 161,169 ****
*/
#ifndef MACOS
! #ifndef __GNUC__
! #define COMPRESS "/usr/local/compress" /* path name for 'compress' */
! #endif
# ifndef COMPRESS
#define ZEROCOMP /* Use only if COMPRESS is not used -- Olaf Seibert */
# endif
--- 156,162 ----
*/
#ifndef MACOS
! #define COMPRESS "/usr/ucb/compress" /* path name for 'compress' */
# ifndef COMPRESS
#define ZEROCOMP /* Use only if COMPRESS is not used -- Olaf Seibert */
# endif
*** netpatch/include/pcconf.h Tue Oct 27 11:51:03 1992
--- /home/share/sources/games/nethack3p10/include/pcconf.h Wed Oct 21 09:01:51 1992
***************
*** 17,27 ****
* The following options are configurable:
*/
! #undef OVERLAY /* MS DOS overlay manager - PGM */
! #ifndef __GNUC__
! #undef DGK /* MS DOS specific enhancements by dgk */
! #endif
#define TERMLIB /* enable use of termcap file /etc/termcap */
/* or ./termcap for MSDOS (SAC) */
--- 17,25 ----
* The following options are configurable:
*/
! #define OVERLAY /* MS DOS overlay manager - PGM */
! #define DGK /* MS DOS specific enhancements by dgk */
#define TERMLIB /* enable use of termcap file /etc/termcap */
/* or ./termcap for MSDOS (SAC) */
***************
*** 29,42 ****
/* enclosed in TERMCAP.ARC, to use this */
#define ANSI_DEFAULT /* allows NetHack to run without a ./termcap */
- #ifdef __GNUC__
- #undef RANDOM
- #undef SHELL /* via exec of COMMAND.COM */
- #else
#define RANDOM /* have Berkeley random(3) */
- #define SHELL /* via exec of COMMAND.COM */
- #endif
#endif /* TOS */
--- 27,35 ----
/* enclosed in TERMCAP.ARC, to use this */
#define ANSI_DEFAULT /* allows NetHack to run without a ./termcap */
#define RANDOM /* have Berkeley random(3) */
+ #define SHELL /* via exec of COMMAND.COM */
#endif /* TOS */
***************
*** 71,77 ****
#include <time.h>
#endif
! #if defined(RANDOM) || defined(__GNUC__)
/* Use the high quality random number routines. */
#define Rand() random()
#define Srand(seed) srandom(seed)
--- 64,70 ----
#include <time.h>
#endif
! #ifdef RANDOM
/* Use the high quality random number routines. */
#define Rand() random()
#define Srand(seed) srandom(seed)
***************
*** 102,108 ****
#undef Getchar
#define Getchar tgetch
#endif
-
#if !defined(TOS) && !defined(AMIGA)
# define TEXTCOLOR /* */
--- 95,100 ----
*** netpatch/include/system.h Tue Oct 27 11:47:57 1992
--- /home/share/sources/games/nethack3p10/include/system.h Wed Feb 6 00:32:30 1991
***************
*** 22,31 ****
# define _SIZE_T
#endif
- #if defined(MSDOS) && defined(__GNUC__) && !defined(_SIZE_T)
- # define _SIZE_T
- #endif
-
#if defined(MSDOS) || ((defined(AMIGA) || defined(MACOS)) && !defined(THINKC4))
# ifndef _SIZE_T
# define _SIZE_T
--- 22,27 ----
***************
*** 63,79 ****
E long random();
E void FDECL(srandom, (unsigned int));
#else
- # if defined(MSDOS) && defined(__GNUC__)
- E long random();
- E void FDECL(srandom, (int));
- # else
E long lrand48();
E void srand48();
- # endif
#endif /* BSD || ULTRIX || RANDOM */
! #if !defined(BSD) || defined(ultrix)
! /* real BSD wants all these to return int */
# ifndef MSDOS
E void FDECL(exit, (int));
# endif /* MSDOS */
--- 59,70 ----
E long random();
E void FDECL(srandom, (unsigned int));
#else
E long lrand48();
E void srand48();
#endif /* BSD || ULTRIX || RANDOM */
! #if !defined(BSD) || defined(ultrix)
! /* real BSD wants all these to return int */
# ifndef MSDOS
E void FDECL(exit, (int));
# endif /* MSDOS */
***************
*** 90,100 ****
E int qsort();
#else
# ifndef LATTICE
- # ifdef __GNUC__
- E void FDECL(qsort, (void*, size_t, size_t, int (*ptf)(const void*,const void*)));
- # else
E void FDECL(qsort, (genericptr_t,size_t,size_t,int(*)(genericptr_t,genericptr_t)));
- # endif
# endif
#endif
--- 81,87 ----
***************
*** 105,115 ****
E int FDECL(write, (int,char *,int));
#else
E long FDECL(lseek, (int,long,int));
- # if defined(MSDOS) && defined(__GNUC__)
- E int FDECL(write, (int,const void *,unsigned));
- # else
E int FDECL(write, (int,genericptr_t,unsigned));
- # endif
#endif /* ULTRIX */
E int FDECL(unlink, (const char *));
--- 92,98 ----
***************
*** 120,130 ****
E int FDECL(dup2, (int, int));
E int FDECL(setmode, (int,int));
E int FDECL(kbhit, (void));
- # ifdef __GNUC__
- E int FDECL(chdir, (const char *));
- # else
E int FDECL(chdir, (char *));
- # endif
E char *FDECL(getcwd, (char *,int));
#endif
#endif /* AZTEC_50 */
--- 103,109 ----
***************
*** 156,171 ****
E void *FDECL(memset, (char*,int,int));
#endif
#ifdef MSDOS
! # if defined(__GNUC__)
! # if defined(TOS)
E int FDECL(memcmp, (const char *,const char *,size_t));
E char *FDECL(memcpy, (char *,const char *,size_t));
E char *FDECL(memset, (char*,int,size_t));
- # else
- E int FDECL(memcmp, (const void *,const void *,size_t));
- E void *FDECL(memcpy, (void *,const void *,size_t));
- E void *FDECL(memset, (void*,int,int));
- # endif /* TOS */
# else
# ifndef LATTICE
# ifdef MSC
--- 135,144 ----
E void *FDECL(memset, (char*,int,int));
#endif
#ifdef MSDOS
! # if defined(TOS) && defined(__GNUC__)
E int FDECL(memcmp, (const char *,const char *,size_t));
E char *FDECL(memcpy, (char *,const char *,size_t));
E char *FDECL(memset, (char*,int,size_t));
# else
# ifndef LATTICE
# ifdef MSC
***************
*** 177,183 ****
E char *FDECL(memset, (char*,int,int));
# endif
# endif
! # endif /* __GNUC__ */
#endif
#if defined(BSD) && defined(ultrix) /* i.e., old versions of Ultrix */
--- 150,156 ----
E char *FDECL(memset, (char*,int,int));
# endif
# endif
! # endif /* TOS */
#endif
#if defined(BSD) && defined(ultrix) /* i.e., old versions of Ultrix */
***************
*** 203,219 ****
/*# string(s).h #*/
E char *FDECL(strcpy, (char *,const char *));
- #if defined(MSDOS) && defined(__GNUC__)
- E char *FDECL(strncpy, (char *,const char *,int));
- #else
E char *FDECL(strncpy, (char *,const char *,size_t));
- #endif
E char *FDECL(strcat, (char *,const char *));
- #if defined(MSDOS) && defined(__GNUC__)
- E char *FDECL(strncat, (char *,const char *,int));
- #else
E char *FDECL(strncat, (char *,const char *,size_t));
- #endif
#if defined(SYSV) || defined(MSDOS) || defined(AMIGA) || defined(THINK_C) || defined(VMS) || defined(HPUX)
E char *FDECL(strchr, (const char *,int));
--- 176,184 ----
***************
*** 225,235 ****
E int FDECL(strcmp, (const char *,const char *));
- #if defined(MSDOS) && defined(__GNUC__)
- E int FDECL(strncmp, (const char *,const char *,int));
- #else
E int FDECL(strncmp, (const char *,const char *,size_t));
- #endif
#ifdef MSDOS
E size_t FDECL(strlen, (const char *));
#else
--- 190,196 ----
***************
*** 261,273 ****
#ifdef NEED_VARARGS
# if defined(USE_STDARG) || defined(USE_VARARGS)
- # if defined(MSDOS) && defined(__GNUC__)
- E int FDECL(vsprintf, (char *, const char *, ...));
- E int FDECL(vprintf, (const char *, ...));
- # else
E int FDECL(vsprintf, (char *, const char *, va_list));
E int FDECL(vprintf, (const char *, va_list));
- # endif
# else
# define vprintf printf
# define vsprintf sprintf
--- 222,229 ----
***************
*** 299,312 ****
#endif
#ifdef MSDOS
- # ifdef __GNUC__
- E int FDECL(tgetent, (char *,char *));
- E int FDECL(tgetnum, (char *));
- E int FDECL(tgetflag, (char *));
- E char *FDECL(tgetstr, (char *,char **));
- E char *FDECL(tgoto, (char *,int,int));
- E int FDECL(tputs, (char *,int,int (*)()));
- # else
E int FDECL(tgetent, (const char *,const char *));
E int FDECL(tgetnum, (const char *));
E int FDECL(tgetflag, (const char *));
--- 255,260 ----
***************
*** 313,319 ****
E char *FDECL(tgetstr, (const char *,char **));
E char *FDECL(tgoto, (const char *,int,int));
E void FDECL(tputs, (const char *,int,int (*)()));
- # endif
#else
E int FDECL(tgetent, (char *,const char *));
E int FDECL(tgetnum, (char *));
--- 261,266 ----
*** netpatch/others/NetHack.cnf Tue Oct 27 11:08:11 1992
--- /home/share/sources/games/nethack3p10/others/NetHack.cnf Tue Jun 26 21:20:10 1990
***************
*** 12,18 ****
# These two options should be used for most setups. If you're machine isn't
# very IBM-compatible, and NetHack doesn't work, try commenting out this line.
#
! #OPTIONS=rawio,IBM_BIOS,IBMgraphics
# DEC Rainbows will hang if rawio is set, so they should instead use:
#OPTIONS=IBM_BIOS,DECgraphics
#
--- 12,18 ----
# These two options should be used for most setups. If you're machine isn't
# very IBM-compatible, and NetHack doesn't work, try commenting out this line.
#
! OPTIONS=rawio,IBM_BIOS,IBMgraphics
# DEC Rainbows will hang if rawio is set, so they should instead use:
#OPTIONS=IBM_BIOS,DECgraphics
#
***************
*** 41,47 ****
#SAVE=c:\games\nethack\bones;n
#
# appending a ";n" to SAVE means don't prompt to insert a disk.
! #SAVE=;n
#
#RAMDISK=d:
--- 41,47 ----
#SAVE=c:\games\nethack\bones;n
#
# appending a ";n" to SAVE means don't prompt to insert a disk.
! SAVE=;n
#
#RAMDISK=d:
*** netpatch/others/msdos.c Tue Oct 27 11:08:55 1992
--- /home/share/sources/games/nethack3p10/others/msdos.c Wed Feb 6 00:03:54 1991
***************
*** 25,33 ****
#include <ctype.h>
#include <fcntl.h>
- # ifndef __GNUC__
#include <process.h>
- #endif
static char NDECL(DOSgetch);
# ifdef DGK
--- 25,31 ----
***************
*** 62,73 ****
tgetch() {
char ch;
! # ifdef DGK
/* BIOSgetch can use the numeric key pad on IBM compatibles. */
if (flags.IBMBIOS)
ch = BIOSgetch();
else
! # endif
ch = DOSgetch();
return ((ch == '\r') ? '\n' : ch);
}
--- 60,71 ----
tgetch() {
char ch;
! # ifdef DGK
/* BIOSgetch can use the numeric key pad on IBM compatibles. */
if (flags.IBMBIOS)
ch = BIOSgetch();
else
! # endif
ch = DOSgetch();
return ((ch == '\r') ? '\n' : ch);
}
***************
*** 276,282 ****
}
return ch;
}
- # endif /* DGK */
static char
DOSgetch() {
--- 274,279 ----
***************
*** 326,332 ****
# endif /* TOS */
}
! #ifdef DGK
# ifndef TOS
# ifdef __TURBOC__
--- 323,329 ----
# endif /* TOS */
}
!
# ifndef TOS
# ifdef __TURBOC__
***************
*** 344,350 ****
}
# endif /* OS2 */
# endif /* __TURBOC__ */
! # endif /* TOS */
static const char *COMSPEC =
# ifdef TOS
--- 341,347 ----
}
# endif /* OS2 */
# endif /* __TURBOC__ */
! # endif /* TOS */
static const char *COMSPEC =
# ifdef TOS
***************
*** 842,849 ****
getreturn("to continue");
return;
}
- #endif /* DGK */
/* Read configuration */
void
read_config_file() {
--- 839,847 ----
getreturn("to continue");
return;
}
+ # endif /* DGK */
+
/* Read configuration */
void
read_config_file() {
***************
*** 1258,1264 ****
# ifdef CHDIR
chdir(orgdir); /* chdir, not chdirx */
chdrive(orgdir);
! # endif /* chdir */
# ifdef TOS
if (run_from_desktop)
getreturn("to continue"); /* so the user can read the score list */
--- 1256,1262 ----
# ifdef CHDIR
chdir(orgdir); /* chdir, not chdirx */
chdrive(orgdir);
! # endif
# ifdef TOS
if (run_from_desktop)
getreturn("to continue"); /* so the user can read the score list */
***************
*** 1265,1272 ****
# ifdef TEXTCOLOR
if (flags.IBMBIOS && flags.use_color)
restore_colors();
! # endif /* TEXTCOLOR */
! # endif /* TOS */
exit(code);
return;
}
--- 1263,1270 ----
# ifdef TEXTCOLOR
if (flags.IBMBIOS && flags.use_color)
restore_colors();
! # endif
! # endif
exit(code);
return;
}
*** netpatch/others/pcmain.c Tue Oct 27 11:09:02 1992
--- /home/share/sources/games/nethack3p10/others/pcmain.c Wed Feb 6 00:03:55 1991
***************
*** 835,843 ****
/* Change the default drive as well.
*/
#ifndef AMIGA
- # ifndef __GNUC__
chdrive(dir);
- # endif
#endif
/* warn the player if we can't write the record file */
--- 835,841 ----
*** netpatch/src/bones.c Wed Oct 28 09:13:25 1992
--- /home/share/sources/games/nethack3p10/src/bones.c Tue Feb 5 23:58:52 1991
***************
*** 150,158 ****
if(discover) return;
#endif
- #ifdef __GNUC__
- strcpy(bones,"bones.xx");
- #endif
name_file(bones, dlevel);
#ifdef COMPRESS
Strcpy(proxy, bones);
--- 150,155 ----
*** netpatch/src/cmd.c Tue Oct 27 12:06:09 1992
--- /home/share/sources/games/nethack3p10/src/cmd.c Thu May 31 00:31:25 1990
***************
*** 42,50 ****
extern int NDECL(doforce); /**/
extern int NDECL(doopen); /**/
extern int NDECL(doclose); /**/
- #ifdef SHELL
extern int NDECL(dosh); /**/
- #endif
extern int NDECL(dodiscovered); /**/
extern int NDECL(doset); /**/
extern int NDECL(dotogglepickup); /**/
--- 42,48 ----
***************
*** 77,85 ****
extern int NDECL(doextversion); /**/
extern int NDECL(dowield); /**/
extern int NDECL(dozap); /**/
- #ifdef __GNUC__
- extern int NDECL(tgetch); /**/
- #endif
#endif /* DUMB */
#ifdef OVL1
--- 75,80 ----
*** netpatch/termcap/tgetent.c Tue Oct 27 11:09:37 1992
--- /home/share/sources/games/nethack3p10/termcap/tgetent.c Tue Oct 27 11:59:23 1992
***************
*** 81,87 ****
* search the path for TERMCAP under Turbo C. -3.
*/
-
#include <stdio.h>
#include <string.h>
--- 81,86 ----
***************
*** 96,104 ****
#ifdef MSDOS
# define DEFAULT_ROOT "termcap" /* name without path component */
- # ifndef __GNUC__
FILE *fopenp();
- # endif
#endif
# define DEFAULT_FILE "/etc/termcap" /* default termcap filename */
--- 95,101 ----
***************
*** 254,260 ****
return fp;
else if (fp = fopen(DEFAULT_FILE, "r"))
return fp;
! # if !defined(__TURBOC__) && !defined(__GNUC__)
else
return fopenp(DEFAULT_ROOT, "r", NULL);
# endif
--- 251,257 ----
return fp;
else if (fp = fopen(DEFAULT_FILE, "r"))
return fp;
! # ifndef __TURBOC__
else
return fopenp(DEFAULT_ROOT, "r", NULL);
# endif
--
Luc Bussieres ---- System Analyst - Dept. of Mathematics and Computer Sciences
University of Sherbrooke
Internet : luc.bussieres@dmi.usherb.ca
Tel: (819) 821-7981