Merge branch 'keni-crashweb3' into NetHack-3.7

This commit is contained in:
nhkeni
2023-09-06 12:39:17 -04:00
30 changed files with 632 additions and 203 deletions

1
doc/.gitattributes vendored
View File

@@ -1,4 +1,5 @@
*.mn NHSUBST
*.tex NHSUBST
*.6 NHSUBST
*.7 NHSUBST
fixes* NHSUBST

View File

@@ -1,4 +1,4 @@
.\" $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.527 $ $NHDT-Date: 1690870385 2023/08/01 06:13:05 $
.\" $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.530 $ $NHDT-Date: 1693082582 2023/08/26 20:43:02 $
.\"
.\" This is an excerpt from the 'roff' man page from the 'groff' package.
.\"+--
@@ -6001,6 +6001,12 @@ When available, it should be left commented out on single player
installations because over time the file could grow to be extremely
large unless it is actively maintained.
.
.lp
CRASHREPORTURL\ =\ If set to
\f(CRhttps://www.nethack.org/common/contact.html\fp
and support is compiled in, brings up a browser window populated with
the information needed to report a problem if the game panics or ends
up in an internally inconsistent state.
.hn 1
Scoring
.pg

View File

@@ -1,5 +1,5 @@
\documentstyle[titlepage,longtable]{article}
% NetHack 3.7 Guidebook.tex $NHDT-Date: 1431192762 2015/12/16 17:32:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.60 $ */
% NetHack 3.7 Guidebook.tex $NHDT-Date: 1693084080 2023/08/26 21:08:00 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.530 $ */
%+% we're still limping along in LaTeX 2.09 compatibility mode
%-%\documentclass{article}
%-%\usepackage{hyperref} % before longtable
@@ -6608,6 +6608,13 @@ Only relevant if the program was built with LIVELOG enabled.
When available, it should be left commented out on single player
installations because over time the file could grow to be extremely
large unless it is actively maintained.
%.lp
\item[\ib{CRASHREPORTURL}]
If set to
{\tt https://www.nethack.org/common/contact.html}
and support is compiled in, brings up a browser window populated with
the information needed to report a problem if the game panics or ends
up in an internally inconsistent state.
\elist
%.hn 1

View File

@@ -8,8 +8,8 @@
.de NR
.ds Nr \\$2
..
.NB $NHDT-Branch: NetHack-3.7 $
.NR $NHDT-Revision: 1.18 $
.NB $NHDT-Branch: keni-crashweb2 $
.NR $NHDT-Revision: 1.21 $
.ds Na Kenneth Lorber
.SH NAME
makedefs \- NetHack miscellaneous build-time functions
@@ -172,6 +172,11 @@ Turn on debug tracing for the grep function (
must be specified as well).
.br
.TP
.BI --grep-defined " symbol"
Exit shell true (0) if
.I symbol
is known and defined, otherwise exit shell false (1).
.TP
.BI --grep-define " symbol"
Force the value of
.I symbol

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 config.h $NHDT-Date: 1692385755 2023/08/18 19:09:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.174 $ */
/* NetHack 3.7 config.h $NHDT-Date: 1693359531 2023/08/30 01:38:51 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.175 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2016. */
/* NetHack may be freely redistributed. See license for details. */
@@ -205,6 +205,10 @@
* The following options pertain to crash reporting:
* GREPPATH (the path to the system grep(1) utility)
* GDBPATH (the path to the system gdb(1) program)
* CRASHREPORT (use CRASHREPORTURL if defined in syscf; this
* define specifies the name of the helper program
* used to launch the browser and enables the
* feature))
* Regular nethack options can also be specified in order to
* provide system-wide default values local to your system:
* OPTIONS (same as in users' .nethackrc or defaults.nh)
@@ -235,6 +239,17 @@
#define GREPPATH "/bin/grep"
#endif
#ifndef CRASHREPORT
# ifdef MACOS
/* NB: This needs to be a full path unless it's in the playground. */
//#define CRASHREPORT "NetHackCrashReport.JavaScript"
# endif
# ifdef __linux__
/* NB: This expects to find the nhlua binary as "./nhlua" */
//#define CRASHREPORT "nhcrashreport.lua"
# endif
#endif
/* note: "larger" is in comparison with 'record', the high-scores file
(whose name can be overridden via #define in global.h if desired) */
#define LOGFILE "logfile" /* larger file for debugging purposes */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 extern.h $NHDT-Date: 1693292519 2023/08/29 07:01:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.1282 $ */
/* NetHack 3.7 extern.h $NHDT-Date: 1693359531 2023/08/30 01:38:51 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.1281 $ */
/* Copyright (c) Steve Creps, 1988. */
/* NetHack may be freely redistributed. See license for details. */
@@ -24,7 +24,7 @@ extern unsigned FITSuint_(unsigned long long, const char *, int);
/* ### allmain.c ### */
extern void early_init(void);
extern void early_init(int, char *[]);
extern void moveloop_core(void);
extern void moveloop(boolean);
extern void stop_occupation(void);
@@ -817,6 +817,11 @@ extern struct kinfo *find_delayed_killer(int);
extern void dealloc_killer(struct kinfo *);
extern void save_killers(NHFILE *);
extern void restore_killers(NHFILE *);
#ifdef CRASHREPORT
extern boolean submit_web_report(const char *, char *);
extern void crashreport_init(int, char *[]);
extern void crashreport_bidshow(void);
#endif
extern char *build_english_list(char *);
#if defined(PANICTRACE) && !defined(NO_SIGNAL)
extern void panictrace_setsignals(boolean);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 hack.h $NHDT-Date: 1689629241 2023/07/17 21:27:21 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.222 $ */
/* NetHack 3.7 hack.h $NHDT-Date: 1693359531 2023/08/30 01:38:51 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.223 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Pasi Kallinen, 2017. */
/* NetHack may be freely redistributed. See license for details. */
@@ -417,6 +417,9 @@ enum earlyarg {
#ifdef WIN32
, ARG_WINDOWS
#endif
#ifdef CRASHREPORT
, ARG_BIDSHOW
#endif
};
struct early_opt {

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 sys.h $NHDT-Date: 1646255373 2022/03/02 21:09:33 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.38 $ */
/* NetHack 3.7 sys.h $NHDT-Date: 1693083207 2023/08/26 20:53:27 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.41 $ */
/* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -40,6 +40,7 @@ struct sysopt {
/* panic options */
char *gdbpath;
char *greppath;
char *crashreporturl;
int panictrace_gdb;
int panictrace_libc;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 allmain.c $NHDT-Date: 1691113621 2023/08/04 01:47:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.220 $ */
/* NetHack 3.7 allmain.c $NHDT-Date: 1693359544 2023/08/30 01:39:04 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.220 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -26,9 +26,14 @@ static void debug_fields(const char *);
static void dump_enums(void);
#endif
/*ARGSUSED*/
void
early_init(void)
early_init(int argc UNUSED, char *argv[] UNUSED)
{
#ifdef CRASHREPORT
// Do this as early as possible, but let ports do other things first.
crashreport_init(argc, argv);
#endif
decl_globals_init();
objects_globals_init();
monst_globals_init();
@@ -906,6 +911,9 @@ static const struct early_opt earlyopts[] = {
#ifdef WIN32
{ ARG_WINDOWS, "windows", 4, TRUE },
#endif
#ifdef CRASHREPORT
{ ARG_BIDSHOW, "bidshow", 7, FALSE },
#endif
};
#ifdef WIN32
@@ -994,6 +1002,11 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
dump_glyphids();
return 2;
#endif
#ifdef CRASHREPORT
case ARG_BIDSHOW:
crashreport_bidshow();
return 2;
#endif
#ifdef WIN32
case ARG_WINDOWS:
if (extended_opt) {

263
src/end.c
View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 end.c $NHDT-Date: 1685863329 2023/06/04 07:22:09 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.274 $ */
/* NetHack 3.7 end.c $NHDT-Date: 1693519356 2023/08/31 22:02:36 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.277 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2012. */
/* NetHack may be freely redistributed. See license for details. */
@@ -47,7 +47,7 @@ ATTRNORETURN extern void nethack_exit(int) NORETURN;
#define done_stopprint gp.program_state.stopprint
#ifndef PANICTRACE
#define NH_abort NH_abort_
#define NH_abort(x) NH_abort_
#endif
#ifdef AMIGA
@@ -77,6 +77,10 @@ ATTRNORETURN extern void nethack_exit(int) NORETURN;
* gdb: +gives more detailed information
* +works on more OS versions
* -requires -g, which may preclude -O on some compilers
*
* And the UI: if sysopt.crashreporturl, and defined(CRASHREPORT)
* we gather the stacktrace (etc) and launch a helper to submit a bug report
* otherwise we just use stdout. Requires libc for now.
*/
#ifdef SYSCF
#define SYSOPT_PANICTRACE_GDB sysopt.panictrace_gdb
@@ -94,11 +98,11 @@ ATTRNORETURN extern void nethack_exit(int) NORETURN;
#endif
#endif
static void NH_abort(void);
static void NH_abort(char *);
#ifndef NO_SIGNAL
static void panictrace_handler(int);
#endif
static boolean NH_panictrace_libc(void);
static boolean NH_panictrace_libc(char *);
static boolean NH_panictrace_gdb(void);
#ifndef NO_SIGNAL
@@ -126,7 +130,7 @@ panictrace_handler(int sig_unused UNUSED)
f2 = (int) write(2, SIG_MSG, sizeof SIG_MSG - 1);
nhUse(f2); /* what could we do if write to fd#2 (stderr) fails */
NH_abort(); /* ... and we're already in the process of quitting? */
NH_abort(NULL); /* ... and we're already in the process of quitting? */
}
void
@@ -166,7 +170,7 @@ panictrace_setsignals(boolean set)
#endif /* NO_SIGNAL */
static void
NH_abort(void)
NH_abort(char *why)
{
int gdb_prio = SYSOPT_PANICTRACE_GDB;
int libc_prio = SYSOPT_PANICTRACE_LIBC;
@@ -183,9 +187,9 @@ NH_abort(void)
gdb_prio++;
if (gdb_prio > libc_prio) {
(void) (NH_panictrace_gdb() || (libc_prio && NH_panictrace_libc()));
(void) (NH_panictrace_gdb() || (libc_prio && NH_panictrace_libc(why)));
} else {
(void) (NH_panictrace_libc() || (gdb_prio && NH_panictrace_gdb()));
(void) (NH_panictrace_libc(why) || (gdb_prio && NH_panictrace_gdb()));
}
#else /* VMS */
@@ -203,9 +207,230 @@ NH_abort(void)
NH_abort_();
}
/* Build a URL with a query string and try to launch a new browser window
* to report from panic() or impossible(). Requires libc support for
* the stacktrace. Uses memory on the stack to avoid memory allocation
* (but libc can still do anything it wants). */
/* size of argument list for execve(2) */
#define SWR_LINES 20
/* max stack frames and header lines (details field) */
#define SWR_FRAMES 20
#define SWR_ADD(line) {if(xargc<(SWR_LINES-1)) xargv[xargc++] = line;}
#ifdef CRASHREPORT
# include <fcntl.h>
# ifdef MACOS
# include <CommonCrypto/CommonDigest.h>
# define HASH_PRAGMA_START
# define HASH_PRAGMA_END
# define HASH_CONTEXT CC_MD4_CTX
# define HASH_INIT(ctx) CC_MD4_Init(ctx)
# define HASH_UPDATE(ctx, ptr, len) CC_MD4_Update(ctx, ptr, len)
# define HASH_FINISH(ctx, out) CC_MD4_Final(out, ctx)
# define HASH_RESULT_SIZE CC_MD4_DIGEST_LENGTH
# endif
# ifdef __linux__
# include <openssl/md4.h>
# define HASH_PRAGMA_START \
_Pragma("GCC diagnostic push"); \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# define HASH_PRAGMA_END _Pragma("GCC diagnostic pop");
# define HASH_CONTEXT MD4_CTX
# define HASH_INIT(ctx) MD4_Init(ctx)
# define HASH_UPDATE(ctx, ptr, len) MD4_Update(ctx, ptr, len)
# define HASH_FINISH(ctx, out) MD4_Final(out, ctx)
# define HASH_RESULT_SIZE MD4_DIGEST_LENGTH
# endif
// Binary ID - Use only as a hint to contact.html for recognizing our own
// binaries. This is easily spoofed!
static char bid[(2*HASH_RESULT_SIZE)+1];
/* ARGSUSED */
void
crashreport_init(int argc UNUSED, char *argv[] UNUSED){
unsigned char tmp[HASH_RESULT_SIZE];
HASH_PRAGMA_START
HASH_CONTEXT ctx;
HASH_INIT(&ctx);
#ifdef MACOS
char *binfile = argv[0];
if(!binfile || !*binfile){
# ifdef BETA
// If this triggers, investigate CFBundleGetMainBundle
// or CFBundleCopyExecutableURL.
raw_print("BETA warning: crashreport_init called without useful info");
# endif
goto skip;
}
#endif
#ifdef __linux__
char binfile[PATH_MAX+1];
int len = readlink("/proc/self/exe", binfile, sizeof(binfile)-1);
if(len>0) {
binfile[len] = '\0';
} else {
goto skip;
}
#endif
int fd = open(binfile, O_RDONLY, 0);
if(fd == -1) {
# ifdef BETA
raw_printf("open e=%s",strerror(errno));
# endif
goto skip;
}
int segsize;
char segment[4096];
while(0 < (segsize = read(fd, segment,sizeof(segment)))){
HASH_UPDATE(&ctx, segment, segsize);
}
HASH_FINISH(&ctx, tmp);
close(fd);
char *p = bid;
unsigned char *in = &tmp[0];
char cnt=HASH_RESULT_SIZE;
while(cnt--){
p += snprintf(p, HASH_RESULT_SIZE-(p-bid), "%02x",*(in++));
}
*p = '\0';
return;
skip:
strncpy((char *)bid,"unknown",sizeof(bid)-1);
HASH_PRAGMA_END
}
#undef HASH_CONTEXT
#undef HASH_INIT
#undef HASH_UPDATE
#undef HASH_FINISH
#undef HASH_RESULT_SIZE
#undef HASH_PRAGMA_START
#undef HASH_PRAGMA_END
void
crashreport_bidshow(void){
raw_print(bid);
}
boolean
submit_web_report(const char *msg, char *why){
if(sysopt.crashreporturl){
const char *xargv[SWR_LINES];
char version[100];
char versionstring[200]; // used twice as a temp
int xargc = 0;
char wholetrace[SWR_LINES*80]; // XXX roughly 71 on MacOS, plus buffer
int prelines = 0; // count of lines in trace header
char nbuf[6]; // number buffer
extern char **environ;
pid_t pid;
SWR_ADD(CRASHREPORT);
SWR_ADD(sysopt.crashreporturl);
// then pairs of key value
// subject, generate something useful
SWR_ADD("subject");
snprintf(version, sizeof(version), "%s report for NetHack %s",
msg, version_string(versionstring, sizeof(versionstring)));
SWR_ADD(version);
// name: someday, this might be stored in nethackcnf
// email: someday, this might be stored in nethackcnf
// gitver, pull from version.c
SWR_ADD("gitver");
SWR_ADD(getversionstring(versionstring, sizeof(versionstring)));
// hardware: leave for user
// software: leave for user
// comments: leave for user
// details: stack trace
SWR_ADD("details");
// XXX header for wholetrace - what other info do we want?
// NB: prelines not tested against size of SWR_FRAMES.
#define SWR_HDR(line) \
if(endp<&wholetrace[sizeof(wholetrace)]){ \
endp+=snprintf(endp, sizeof(wholetrace)-(endp-wholetrace), "%s\n",line); \
prelines++; \
}
#define SWR_HDRnonl(line) \
if(endp<&wholetrace[sizeof(wholetrace)]){ \
endp+=snprintf(endp, sizeof(wholetrace)-(endp-wholetrace), "%s",line); \
}
char *endp = wholetrace;
wholetrace[0] = 0;
if(why){
SWR_HDR(why);
}
SWR_HDRnonl("bid: ");
SWR_HDR(bid);
void *bt[SWR_FRAMES];
int count, x;
char **info, buf[BUFSZ];
count = backtrace(bt, SIZE(bt));
info = backtrace_symbols(bt, count);
for (x = 0; x < count; x++) {
copynchars(buf, info[x], (int) sizeof buf - 1);
/* try to remove up to 16 blank spaces by removing 8 twice */
(void) strsubst(buf, " ", "");
(void) strsubst(buf, " ", "");
snprintf(endp, SWR_FRAMES*80-(endp-wholetrace), "[%02lu] %s\n",
(unsigned long) x, buf);
endp = eos(endp);
}
*(endp-1) = '\0'; // remove last newline
SWR_ADD(wholetrace);
// detailrows min(actual,50) Guess since we can't know the
// width of the window.
SWR_ADD("detailrows");
(void)snprintf(nbuf,sizeof(nbuf),"%d",count+prelines);
SWR_ADD(nbuf);
xargv[xargc++] = 0; // terminate array
pid = fork();
if( pid == 0 ){
execve(CRASHREPORT, (char * const *)xargv, environ);
char err[100];
sprintf(err, "Can't start " CRASHREPORT ": %s", strerror(errno));
raw_print(err);
} else {
int status;
errno=0;
// XXX do we _really_ know this is the right pid?
(void)waitpid(pid, &status, 0);
if(status){ // XXX check could be more precise
#if 0
// Not useful at the moment. XXX
char err[100];
sprintf(err, "pid=%d e=%d status=%0x",wpid,errno,status);
raw_print(err);
#endif
return FALSE;
}
}
/* free(info); -- Don't risk it. */
return TRUE;
}
return FALSE;
}
#endif // CRASHREPORT
#undef SWR_ADD
#undef SWR_FRAMES
#undef SWR_HDR
#undef SWR_LINES
/*ARGSUSED*/
static boolean
NH_panictrace_libc(void)
NH_panictrace_libc(char *why UNUSED)
{
#ifdef CRASHREPORT
if(submit_web_report("Panic",why)) return TRUE;
#endif
#ifdef PANICTRACE_LIBC
void *bt[20];
int count, x;
@@ -375,7 +600,7 @@ done2(void)
(*soundprocs.sound_exit_nhsound)("done2");
exit_nhwindows((char *) 0);
NH_abort();
NH_abort(NULL);
} else if (c == 'q')
done_stopprint++;
}
@@ -618,11 +843,12 @@ DISABLE_WARNING_FORMAT_NONLITERAL
ATTRNORETURN void
panic VA_DECL(const char *, str)
{
char buf[BUFSZ];
VA_START(str);
VA_INIT(str, char *);
if (gp.program_state.panicking++)
NH_abort(); /* avoid loops - this should never happen*/
NH_abort(NULL); /* avoid loops - this should never happen*/
if (iflags.window_inited) {
raw_print("\r\nOops...");
@@ -651,6 +877,7 @@ panic VA_DECL(const char *, str)
? "."
: "\nand it may be possible to rebuild.";
// XXX this is probably wrong if defined(CRASHREPORT)
if (sysopt.support)
raw_printf("To report this error, %s%s", sysopt.support,
maybe_rebuild);
@@ -674,19 +901,19 @@ panic VA_DECL(const char *, str)
}
}
#endif /* !MICRO */
{
char buf[BUFSZ];
(void) vsnprintf(buf, sizeof buf, str, VA_ARGS);
raw_print(buf);
paniclog("panic", buf);
}
(void) vsnprintf(buf, sizeof buf, str, VA_ARGS);
raw_print(buf);
paniclog("panic", buf);
#ifdef WIN32
interject(INTERJECT_PANIC);
#endif
#if defined(UNIX) || defined(VMS) || defined(LATTICE) || defined(WIN32)
# ifndef CRASHREPORT
if (wizard)
NH_abort(); /* generate core dump */
# endif
NH_abort(buf); /* generate core dump */
#endif
VA_END();
really_done(PANICKED);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 files.c $NHDT-Date: 1680625799 2023/04/04 16:29:59 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.373 $ */
/* NetHack 3.7 files.c $NHDT-Date: 1693083234 2023/08/26 20:53:54 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.378 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -194,6 +194,7 @@ static boolean cnf_line_PANICTRACE_LIBC(char *);
static boolean cnf_line_PANICTRACE_GDB(char *);
static boolean cnf_line_GDBPATH(char *);
static boolean cnf_line_GREPPATH(char *);
static boolean cnf_line_CRASHREPORTURL(char *);
static boolean cnf_line_SAVEFORMAT(char *);
static boolean cnf_line_BONESFORMAT(char *);
static boolean cnf_line_ACCESSIBILITY(char *);
@@ -3011,6 +3012,15 @@ cnf_line_GREPPATH(char *bufp)
return TRUE;
}
static boolean
cnf_line_CRASHREPORTURL(char *bufp)
{
if (sysopt.crashreporturl)
free((genericptr_t) sysopt.crashreporturl);
sysopt.crashreporturl = dupstr(bufp);
return TRUE;
}
static boolean
cnf_line_SAVEFORMAT(char *bufp)
{
@@ -3253,6 +3263,7 @@ static const struct match_config_line_stmt {
CNFL_S(LIVELOG, 7),
CNFL_S(PANICTRACE_LIBC, 15),
CNFL_S(PANICTRACE_GDB, 14),
CNFL_S(CRASHREPORTURL, 13),
CNFL_S(GDBPATH, 7),
CNFL_S(GREPPATH, 7),
CNFL_S(SAVEFORMAT, 10),

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 pline.c $NHDT-Date: 1646255375 2022/03/02 21:09:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.109 $ */
/* NetHack 3.7 pline.c $NHDT-Date: 1693083243 2023/08/26 20:54:03 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.124 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2018. */
/* NetHack may be freely redistributed. See license for details. */
@@ -505,6 +505,7 @@ impossible(const char *s, ...)
{
va_list the_args;
char pbuf[BIGBUFSZ]; /* will be chopped down to BUFSZ-1 if longer */
char pbuf2[BUFSZ];
va_start(the_args, s);
if (gp.program_state.in_impossible)
@@ -521,16 +522,26 @@ impossible(const char *s, ...)
gp.pline_flags = URGENT_MESSAGE;
pline("%s", pbuf);
gp.pline_flags = 0;
/* reuse pbuf[] */
Strcpy(pbuf, "Program in disorder!");
Strcpy(pbuf2, "Program in disorder!");
if (gp.program_state.something_worth_saving)
Strcat(pbuf, " (Saving and reloading may fix this problem.)");
pline("%s", pbuf);
Strcat(pbuf2, " (Saving and reloading may fix this problem.)");
pline("%s", pbuf2);
pline("Please report these messages to %s.", DEVTEAM_EMAIL);
if (sysopt.support) {
pline("Alternatively, contact local support: %s", sysopt.support);
}
#ifdef CRASHREPORT
if(sysopt.crashreporturl){
boolean report = ('y' == yn_function("Report now?","yn",'n',FALSE));
raw_print(""); // prove to the user the character was accepted
if(report){
submit_web_report("Impossible", pbuf);
}
}
#endif
gp.program_state.in_impossible = 0;
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 sys.c $NHDT-Date: 1596498215 2020/08/03 23:43:35 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.57 $ */
/* NetHack 3.7 sys.c $NHDT-Date: 1693083254 2023/08/26 20:54:14 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.63 $ */
/* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */
/* NetHack may be freely redistributed. See license for details. */
@@ -70,6 +70,7 @@ sys_early_init(void)
#endif
#endif
#endif
sysopt.crashreporturl = NULL;
sysopt.check_save_uid = 1;
sysopt.check_plname = 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 libnhmain.c $NHDT-Date: 1596498297 2020/08/03 23:44:57 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.87 $ */
/* NetHack 3.7 libnhmain.c $NHDT-Date: 1693359589 2023/08/30 01:39:49 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.106 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -79,7 +79,7 @@ nhmain(int argc, char *argv[])
// printf ("argv[%d]: %s\n", i, argv[i]);
// }
early_init();
early_init(argc, argv);
gh.hname = argv[0];
gh.hackpid = getpid();
@@ -103,6 +103,11 @@ nhmain(int argc, char *argv[])
if (argcheck(argc, argv, ARG_VERSION) == 2)
exit(EXIT_SUCCESS);
#ifdef CRASHREPORT
if (argcheck(argc, argv, ARG_BIDSHOW))
exit(EXIT_SUCCESS);
#endif
if (argcheck(argc, argv, ARG_SHOWPATHS) == 2) {
#ifdef CHDIR
chdirx((char *) 0, 0);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 pcmain.c $NHDT-Date: 1596498282 2020/08/03 23:44:42 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.121 $ */
/* NetHack 3.7 pcmain.c $NHDT-Date: 1693359605 2023/08/30 01:40:05 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.133 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -76,7 +76,7 @@ mingw_main(int argc, char *argv[])
{
boolean resuming;
early_init();
early_init(argc, argv);
resuming = pcmain(argc, argv);
moveloop(resuming);
nethack_exit(EXIT_SUCCESS);

View File

@@ -1,5 +1,5 @@
# NetHack Makefile.
# NetHack 3.7 Makefile.src $NHDT-Date: 1654287121 2022/06/03 20:12:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.145 $
# NetHack 3.7 Makefile.src $NHDT-Date: 1693519377 2023/08/31 22:02:57 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.162 $
# Copyright (c) 2018 by Pasi Kallinen
# NetHack may be freely redistributed. See license for details.
@@ -624,7 +624,8 @@ $(GAME): pregame $(MAKEDEFS) $(LUALIB) $(WAVS) $(SYSTEM)
Sysunix: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile
@echo "Linking $(GAME)."
$(AT)$(TARGET_LINK) $(TARGET_LFLAGS) -o $(GAMEBIN) \
$(HOBJ) $(DATE_O) $(WINLIB) $(TARGET_LIBS) $(LUALIBS)
$(HOBJ) $(DATE_O) $(WINLIB) $(TARGET_LIBS) $(LUALIBS) \
$(AUTOLIBS)
@touch Sysunix
Sys3B2: $(HOSTOBJ) $(HOBJ) $(DATE_O) $(BUILDMORE) Makefile

View File

@@ -1,5 +1,5 @@
# NetHack Top-level Makefile.
# NetHack 3.7 Makefile.top $NHDT-Date: 1642630921 2022/01/19 22:22:01 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.72 $
# NetHack 3.7 Makefile.top $NHDT-Date: 1693519381 2023/08/31 22:03:01 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.91 $
# Copyright (c) 2015 by Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details.
@@ -112,7 +112,7 @@ LUA2NHTOP = ../../..
LUABASELIB = liblua-$(LUA_VERSION).a
TOPLUALIB = lib/lua/$(LUABASELIB)
ALLDEP = $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb
ALLDEP = $(GAME) recover Guidebook $(VARDAT) spec_levs check-dlb check-nhlua
# first target is also the default target for 'make' without any arguments
all: $(ALLDEP)
@@ -125,8 +125,9 @@ $(GAME): lua_support
lua_support: include/nhlua.h
@true
$(LUATOP)/liblua.a: $(LUAHEADERS)/lua.h
( cd $(LUATOP) \
&& make $(LUAMAKEFLAGS) a && cd $(LUA2NHTOP) )
( cd $(LUATOP) && make $(LUAMAKEFLAGS) a ) && \
( util/makedefs --grep-defined CRASHREPORT && ( \
cd $(LUATOP) && make $(LUAMAKEFLAGS) ); true )
$(TOPLUALIB): $(LUATOP)/liblua.a
@( if test -d lib/lua ; then true ; else mkdir -p lib/lua ; fi )
cp $(LUATOP)/liblua.a $@
@@ -147,6 +148,10 @@ luabin:
( cd $(LUATOP) \
&& make $(LUAMAKEFILES) all && cd $(LUA2NHTOP) )
check-nhlua:
( util/makedefs --grep-defined CRASHREPORT && ( \
cd $(LUATOP) && make $(LUAMAKEFLAGS) ); true )
# hints file could set LUATESTTARGET to this if GITSUBMODULES is defined
submodules/lua/lua.h:
git submodule init submodules/lua

View File

@@ -1,4 +1,4 @@
# NetHack 3.7 linux.370 $NHDT-Date: 1668359835 2022/11/13 17:17:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.50 $
# NetHack 3.7 linux.370 $NHDT-Date: 1693519390 2023/08/31 22:03:10 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.61 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2007.
# NetHack may be freely redistributed. See license for details.
#
@@ -96,6 +96,8 @@ endif #HAVE_NCURSESW
endif #MAKEFILE_SRC
endif #USE_CURSESLIB
AUTOLIBS=$(shell (../util/makedefs --grep-defined CRASHREPORT && echo "-lcrypto" ) || true )
# NetHack sources control
NHCFLAGS+=-DDLB
NHCFLAGS+=-DHACKDIR=\"$(HACKDIR)\"
@@ -289,7 +291,11 @@ VARDIR = $(HACKDIR)
POSTINSTALL+= cp -n sys/unix/sysconf $(INSTDIR)/sysconf; \
$(CHOWN) $(GAMEUID) $(INSTDIR)/sysconf; \
$(CHGRP) $(GAMEGRP) $(INSTDIR)/sysconf; \
chmod $(VARFILEPERM) $(INSTDIR)/sysconf;
chmod $(VARFILEPERM) $(INSTDIR)/sysconf; \
( util/makedefs --grep-defined CRASHREPORT && \
( cp win/share/nhcrashreport.lua $(INSTDIR) ; \
chmod 555 $(INSTDIR)/nhcrashreport.lua ; \
cp $(LUATOP)/lua $(INSTDIR)/nhlua); true)
ifneq "$(CCISCLANG)" ""
# gdb may not be installed if clang is chosen compiler so the game

View File

@@ -1,4 +1,4 @@
# NetHack 3.7 macOS.370 $NHDT-Date: 1668359835 2022/11/13 17:17:15 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.116 $
# NetHack 3.7 macOS.370 $NHDT-Date: 1693359574 2023/08/30 01:39:34 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.138 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015.
# NetHack may be freely redistributed. See license for details.
#
@@ -97,6 +97,8 @@ NHCFLAGS+=-DNOMAIL
#NHCFLAGS+=-DTTY_SOUND_ESCCODES
#NHCFLAGS+=-DNO_CHRONICLE
#NHCFLAGS+=-DLIVELOG
# not NHCFLAGS - needed for makedefs
CFLAGS+=-DCRASHREPORT=\"NetHackCrashReport.JavaScript\"
ifdef MAKEFILE_SRC
# default
@@ -328,11 +330,14 @@ ROOTCHECK= [[ `id -u` == 0 ]] || ( echo "Must run install with sudo."; exit 1)
# make sure we have group GAMEUID and group GAMEGRP
PREINSTALL= . sys/unix/hints/macosx.sh user2 $(GAMEUID); \
. sys/unix/hints/macosx.sh group2 $(GAMEGRP); \
mkdir $(SHELLDIR); chown $(GAMEUID) $(SHELLDIR)
(mkdir $(SHELLDIR) || true); chown $(GAMEUID) $(SHELLDIR)
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
$(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
$(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
chmod $(VARFILEPERM) $(HACKDIR)/sysconf; \
util/makedefs --grep-defined CRASHREPORT && \
( cp win/macosx/NetHackCrashReport.JavaScript $(HACKDIR) && \
chmod 0500 $(HACKDIR)/NetHackCrashReport.JavaScript )
else ifdef WANT_SOURCE_INSTALL
@@ -348,7 +353,11 @@ CHGRP=/usr/bin/true
GAMEPERM = 0700
VARFILEPERM = 0600
VARDIRPERM = 0700
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf;
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
util/makedefs --grep-defined CRASHREPORT && \
( cp win/macosx/NetHackCrashReport.JavaScript $(HACKDIR) && \
chmod 0500 $(HACKDIR)/NetHackCrashReport.JavaScript )
# We can use "make all" to build the whole thing - but it misses some things:
MOREALL=$(MAKE) install
CFLAGS+=-DSYSCF -DSYSCF_FILE=\"$(HACKDIR)/sysconf\" -DSECURE
@@ -376,7 +385,10 @@ PREINSTALL+= (mkdir $(SHELLDIR) || true);
POSTINSTALL+= sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(HACKDIR)/sysconf; \
$(CHOWN) $(GAMEUID) $(HACKDIR)/sysconf; \
$(CHGRP) $(GAMEGRP) $(HACKDIR)/sysconf; \
chmod $(VARFILEPERM) $(HACKDIR)/sysconf;
chmod $(VARFILEPERM) $(HACKDIR)/sysconf; \
util/makedefs --grep-defined CRASHREPORT && \
( cp win/macosx/NetHackCrashReport.JavaScript $(HACKDIR) && \
chmod 0500 $(HACKDIR)/NetHackCrashReport.JavaScript )
endif # !WANT_SHARE_INSTALL
@@ -719,6 +731,7 @@ build_package_root:
install -p doc/recover.6 $(PKGROOT_UG)/man/man6
install -p doc/Guidebook $(PKGROOT_UG)/doc
install -p dat/nhdat $(PKGROOT_UGLN)
#XXX no code to package NetHackCrashReport.JavaScript
sys/unix/hints/macosx.sh editsysconf sys/unix/sysconf $(PKGROOT_UGLN)/sysconf
cd dat; install -p $(DATNODLB) ../$(PKGROOT_UGLN)
# XXX these files should be somewhere else for good Mac form

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 unixmain.c $NHDT-Date: 1646313937 2022/03/03 13:25:37 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.99 $ */
/* NetHack 3.7 unixmain.c $NHDT-Date: 1693359574 2023/08/30 01:39:34 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.117 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -65,7 +65,7 @@ main(int argc, char *argv[])
boolean resuming = FALSE; /* assume new game */
boolean plsel_once = FALSE;
early_init();
early_init(argc, argv);
#if defined(__APPLE__)
{
@@ -623,6 +623,15 @@ early_options(int *argc_p, char ***argv_p, char **hackdir_p)
++arg;
switch (arg[1]) { /* char after leading dash */
case 'b':
#ifdef CRASHREPORT
// --bidshow
if (argcheck(argc, argv, ARG_BIDSHOW) == 2){
opt_terminate();
/*NOTREACHED*/
}
#endif
break;
case 'd':
if (argcheck(argc, argv, ARG_DEBUG) == 1) {
consume_arg(ndx, argc_p, argv_p), consumed = 1;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 vmsmain.c $NHDT-Date: 1596498307 2020/08/03 23:45:07 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.45 $ */
/* NetHack 3.7 vmsmain.c $NHDT-Date: 1693359633 2023/08/30 01:40:33 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.57 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Robert Patrick Rankin, 2011. */
/* NetHack may be freely redistributed. See license for details. */
@@ -50,7 +50,7 @@ main(int argc, char *argv[])
privon();
#endif
early_init();
early_init(argc, argv);
atexit(byebye);
/* vms_basename(,FALSE) strips device, directory, suffix, and version;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 windmain.c $NHDT-Date: 1596498320 2020/08/03 23:45:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.157 $ */
/* NetHack 3.7 windmain.c $NHDT-Date: 1693359653 2023/08/30 01:40:53 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.189 $ */
/* Copyright (c) Derek S. Ray, 2015. */
/* NetHack may be freely redistributed. See license for details. */
@@ -484,7 +484,7 @@ MAIN(int argc, char *argv[])
safe_routines();
#endif /* WIN32CON */
early_init();
early_init(argc, argv);
#ifdef _MSC_VER
#ifdef DEBUG
/* set these appropriately for VS debugging */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 makedefs.c $NHDT-Date: 1655402416 2022/06/16 18:00:16 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.215 $ */
/* NetHack 3.7 makedefs.c $NHDT-Date: 1693083328 2023/08/26 20:55:28 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.226 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Kenneth Lorber, Kensington, Maryland, 2015. */
/* Copyright (c) M. Stephenson, 1990, 1991. */
@@ -571,6 +571,15 @@ do_ext_makedefs(int argc, char **argv)
}
CONTINUE;
}
IS_OPTION("grep-defined"){
struct grep_var *p;
CONSUME;
p = grepsearch(argv[0]);
// NB: Exit status is ready for the shell:
// 0=defined, 1=not defined
makedefs_exit(!(p && p->is_defined));
}
#ifdef notyet
IS_OPTION("help") {
}

View File

@@ -1,277 +1,283 @@
/*
* NetHack 3.7 mdgrep.h $NHDT-Date: 1596498259 2020/08/03 23:44:19 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.14 $
* NetHack 3.7 mdgrep.h $NHDT-Date: 1693083343 2023/08/26 20:55:43 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.18 $
* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008
* NetHack may be freely redistributed. See license for details.
*
* This file generated by mdgrep.pl version 1.7.
* This file generated by mdgrep.pl version 1.23.
* DO NOT EDIT! Your changes will be lost.
*/
static struct grep_var grep_vars[] = { { "0", 0 },
{ "1", 1 },
static struct grep_var grep_vars[]={
{"0", 0},
{"1", 1},
#if defined(ALLDOCS)
{ "ALLDOCS", 1 },
{"ALLDOCS", 1},
#else
{ "ALLDOCS", 0 },
{"ALLDOCS", 0},
#endif
#if defined(AMIGA)
{ "AMIGA", 1 },
{"AMIGA", 1},
#else
{ "AMIGA", 0 },
{"AMIGA", 0},
#endif
#if defined(AMII_GRAPHICS)
{ "AMII_GRAPHICS", 1 },
{"AMII_GRAPHICS", 1},
#else
{ "AMII_GRAPHICS", 0 },
{"AMII_GRAPHICS", 0},
#endif
#if defined(ASCIIGRAPH)
{ "ASCIIGRAPH", 1 },
{"ASCIIGRAPH", 1},
#else
{ "ASCIIGRAPH", 0 },
{"ASCIIGRAPH", 0},
#endif
#if defined(BETA)
{ "BETA", 1 },
{"BETA", 1},
#else
{ "BETA", 0 },
{"BETA", 0},
#endif
#if defined(BSD_JOB_CONTROL)
{ "BSD_JOB_CONTROL", 1 },
{"BSD_JOB_CONTROL", 1},
#else
{ "BSD_JOB_CONTROL", 0 },
{"BSD_JOB_CONTROL", 0},
#endif
#if defined(CLIPPING)
{ "CLIPPING", 1 },
{"CLIPPING", 1},
#else
{ "CLIPPING", 0 },
{"CLIPPING", 0},
#endif
#if defined(COMPRESS)
{ "COMPRESS", 1 },
{"COMPRESS", 1},
#else
{ "COMPRESS", 0 },
{"COMPRESS", 0},
#endif
#if defined(CRASHREPORT)
{"CRASHREPORT", 1},
#else
{"CRASHREPORT", 0},
#endif
#if defined(DLB)
{ "DLB", 1 },
{"DLB", 1},
#else
{ "DLB", 0 },
{"DLB", 0},
#endif
{ "FALSE", 0 },
{"FALSE", 0},
#if defined(GEM_GRAPHICS)
{ "GEM_GRAPHICS", 1 },
{"GEM_GRAPHICS", 1},
#else
{ "GEM_GRAPHICS", 0 },
{"GEM_GRAPHICS", 0},
#endif
#if defined(GNOME_GRAPHICS)
{ "GNOME_GRAPHICS", 1 },
{"GNOME_GRAPHICS", 1},
#else
{ "GNOME_GRAPHICS", 0 },
{"GNOME_GRAPHICS", 0},
#endif
#if defined(HANGUPHANDLING)
{ "HANGUPHANDLING", 1 },
{"HANGUPHANDLING", 1},
#else
{ "HANGUPHANDLING", 0 },
{"HANGUPHANDLING", 0},
#endif
#if defined(INSURANCE)
{ "INSURANCE", 1 },
{"INSURANCE", 1},
#else
{ "INSURANCE", 0 },
#endif
#if defined(LIFE)
{ "LIFE", 1 },
#else
{ "LIFE", 0 },
{"INSURANCE", 0},
#endif
#if defined(MAC)
{ "MAC", 1 },
{"MAC", 1},
#else
{ "MAC", 0 },
{"MAC", 0},
#endif
#if defined(MAC_GRAPHICS)
{ "MAC_GRAPHICS", 1 },
{"MAC_GRAPHICS", 1},
#else
{ "MAC_GRAPHICS", 0 },
{"MAC_GRAPHICS", 0},
#endif
#if defined(MAIL)
{ "MAIL", 1 },
{"MAIL", 1},
#else
{ "MAIL", 0 },
{"MAIL", 0},
#endif
#if defined(MFLOPPY)
{ "MFLOPPY", 1 },
{"MFLOPPY", 1},
#else
{ "MFLOPPY", 0 },
{"MFLOPPY", 0},
#endif
#if defined(MSDOS)
{ "MSDOS", 1 },
{"MSDOS", 1},
#else
{ "MSDOS", 0 },
{"MSDOS", 0},
#endif
#if defined(MSWIN_GRAPHICS)
{ "MSWIN_GRAPHICS", 1 },
{"MSWIN_GRAPHICS", 1},
#else
{ "MSWIN_GRAPHICS", 0 },
{"MSWIN_GRAPHICS", 0},
#endif
#if defined(NOCWD_ASSUMPTIONS)
{ "NOCWD_ASSUMPTIONS", 1 },
{"NOCWD_ASSUMPTIONS", 1},
#else
{ "NOCWD_ASSUMPTIONS", 0 },
{"NOCWD_ASSUMPTIONS", 0},
#endif
#if defined(NOSAVEONHANGUP)
{ "NOSAVEONHANGUP", 1 },
{"NOSAVEONHANGUP", 1},
#else
{ "NOSAVEONHANGUP", 0 },
{"NOSAVEONHANGUP", 0},
#endif
#if defined(OS2)
{ "OS2", 1 },
{"OS2", 1},
#else
{ "OS2", 0 },
{"OS2", 0},
#endif
#if defined(POSIX_JOB_CONTROL)
{ "POSIX_JOB_CONTROL", 1 },
{"POSIX_JOB_CONTROL", 1},
#else
{ "POSIX_JOB_CONTROL", 0 },
{"POSIX_JOB_CONTROL", 0},
#endif
#if defined(QT_GRAPHICS)
{ "QT_GRAPHICS", 1 },
{"QT_GRAPHICS", 1},
#else
{ "QT_GRAPHICS", 0 },
{"QT_GRAPHICS", 0},
#endif
#if defined(RANDOM)
{ "RANDOM", 1 },
{"RANDOM", 1},
#else
{ "RANDOM", 0 },
{"RANDOM", 0},
#endif
#if defined(SAFERHANGUP)
{ "SAFERHANGUP", 1 },
{"SAFERHANGUP", 1},
#else
{ "SAFERHANGUP", 0 },
{"SAFERHANGUP", 0},
#endif
#if defined(SECURE)
{ "SECURE", 1 },
{"SECURE", 1},
#else
{ "SECURE", 0 },
{"SECURE", 0},
#endif
#if defined(SHELL)
{ "SHELL", 1 },
{"SHELL", 1},
#else
{ "SHELL", 0 },
{"SHELL", 0},
#endif
#if defined(SUSPEND)
{ "SUSPEND", 1 },
{"SUSPEND", 1},
#else
{ "SUSPEND", 0 },
{"SUSPEND", 0},
#endif
#if defined(TEXTCOLOR)
{ "TEXTCOLOR", 1 },
{"TEXTCOLOR", 1},
#else
{ "TEXTCOLOR", 0 },
#endif
#if defined(TOS)
{ "TOS", 1 },
#else
{ "TOS", 0 },
#endif
{ "TRUE", 1 },
#if defined(TTY_GRAPHICS)
{ "TTY_GRAPHICS", 1 },
#else
{ "TTY_GRAPHICS", 0 },
#endif
#if defined(UNICODE_DRAWING)
{ "UNICODE_DRAWING", 1 },
#else
{ "UNICODE_DRAWING", 0 },
#endif
#if defined(UNICODE_PLAYERTEXT)
{ "UNICODE_PLAYERTEXT", 1 },
#else
{ "UNICODE_PLAYERTEXT", 0 },
#endif
#if defined(UNICODE_WIDEWINPORT)
{ "UNICODE_WIDEWINPORT", 1 },
#else
{ "UNICODE_WIDEWINPORT", 0 },
#endif
#if defined(UNIX)
{ "UNIX", 1 },
#else
{ "UNIX", 0 },
#endif
#if defined(USER_SOUNDS)
{ "USER_SOUNDS", 1 },
#else
{ "USER_SOUNDS", 0 },
{"TEXTCOLOR", 0},
#endif
#if defined(TILES_IN_GLYPHMAP)
{ "TILES_IN_GLYPHMAP", 1 },
{"TILES_IN_GLYPHMAP", 1},
#else
{ "TILES_IN_GLYPHMAP", 0 },
{"TILES_IN_GLYPHMAP", 0},
#endif
#if defined(TOS)
{"TOS", 1},
#else
{"TOS", 0},
#endif
{"TRUE", 1},
#if defined(TTY_GRAPHICS)
{"TTY_GRAPHICS", 1},
#else
{"TTY_GRAPHICS", 0},
#endif
#if defined(UNICODE_DRAWING)
{"UNICODE_DRAWING", 1},
#else
{"UNICODE_DRAWING", 0},
#endif
#if defined(UNICODE_PLAYERTEXT)
{"UNICODE_PLAYERTEXT", 1},
#else
{"UNICODE_PLAYERTEXT", 0},
#endif
#if defined(UNICODE_WIDEWINPORT)
{"UNICODE_WIDEWINPORT", 1},
#else
{"UNICODE_WIDEWINPORT", 0},
#endif
#if defined(UNIX)
{"UNIX", 1},
#else
{"UNIX", 0},
#endif
#if defined(USER_SOUNDS)
{"USER_SOUNDS", 1},
#else
{"USER_SOUNDS", 0},
#endif
#if defined(VAR_PLAYGROUND)
{ "VAR_PLAYGROUND", 1 },
{"VAR_PLAYGROUND", 1},
#else
{ "VAR_PLAYGROUND", 0 },
{"VAR_PLAYGROUND", 0},
#endif
#if defined(VMS)
{ "VMS", 1 },
{"VMS", 1},
#else
{ "VMS", 0 },
{"VMS", 0},
#endif
#if defined(WIN32)
{ "WIN32", 1 },
{"WIN32", 1},
#else
{ "WIN32", 0 },
{"WIN32", 0},
#endif
#if defined(WIN32_PLATFORM_HPCPRO)
{ "WIN32_PLATFORM_HPCPRO", 1 },
{"WIN32_PLATFORM_HPCPRO", 1},
#else
{ "WIN32_PLATFORM_HPCPRO", 0 },
{"WIN32_PLATFORM_HPCPRO", 0},
#endif
#if defined(WIN32_PLATFORM_WFSP)
{ "WIN32_PLATFORM_WFSP", 1 },
{"WIN32_PLATFORM_WFSP", 1},
#else
{ "WIN32_PLATFORM_WFSP", 0 },
{"WIN32_PLATFORM_WFSP", 0},
#endif
#if defined(WINNT)
{"WINNT", 1},
#else
{"WINNT", 0},
#endif
#if defined(WIN_CE)
{ "WIN_CE", 1 },
{"WIN_CE", 1},
#else
{ "WIN_CE", 0 },
{"WIN_CE", 0},
#endif
#if defined(WIN_CE_POCKETPC)
{ "WIN_CE_POCKETPC", 1 },
{"WIN_CE_POCKETPC", 1},
#else
{ "WIN_CE_POCKETPC", 0 },
{"WIN_CE_POCKETPC", 0},
#endif
#if defined(WIN_CE_PS2xx)
{ "WIN_CE_PS2xx", 1 },
{"WIN_CE_PS2xx", 1},
#else
{ "WIN_CE_PS2xx", 0 },
{"WIN_CE_PS2xx", 0},
#endif
#if defined(WIN_CE_SMARTPHONE)
{ "WIN_CE_SMARTPHONE", 1 },
{"WIN_CE_SMARTPHONE", 1},
#else
{ "WIN_CE_SMARTPHONE", 0 },
{"WIN_CE_SMARTPHONE", 0},
#endif
{ "WIZARD", 1 },
#if defined(X11_GRAPHICS)
{ "X11_GRAPHICS", 1 },
{"X11_GRAPHICS", 1},
#else
{ "X11_GRAPHICS", 0 },
{"X11_GRAPHICS", 0},
#endif
#if defined(ZEROCOMP)
{ "ZEROCOMP", 1 },
{"ZEROCOMP", 1},
#else
{ "ZEROCOMP", 0 },
{"ZEROCOMP", 0},
#endif
#if defined(ZLIB_COMP)
{ "ZLIB_COMP", 1 },
{"ZLIB_COMP", 1},
#else
{ "ZLIB_COMP", 0 },
{"ZLIB_COMP", 0},
#endif
#if defined(__BEOS__)
{ "__BEOS__", 1 },
{"__BEOS__", 1},
#else
{ "__BEOS__", 0 },
{"__BEOS__", 0},
#endif
{ 0, 0 } };
{0,0}
};
/* Command ids */
#define TODO_GREP 1

View File

@@ -1,5 +1,5 @@
#!perl
# NetHack 3.7 mdgrep.pl $NHDT-Date: 1596498260 2020/08/03 23:44:20 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.20 $
# NetHack 3.7 mdgrep.pl $NHDT-Date: 1693083351 2023/08/26 20:55:51 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.24 $
# Copyright (c) Kenneth Lorber, Kensington, Maryland
# NetHack may be freely redistributed. See license for details.
@@ -23,6 +23,7 @@
VAR_PLAYGROUND DLB SHELL SUSPEND NOSAVEONHANGUP HANGUPHANDLING
BSD_JOB_CONTROL MAIL POSIX_JOB_CONTROL INSURANCE
UNICODE_DRAWING UNICODE_WIDEWINPORT UNICODE_PLAYERTEXT
CRASHREPORT
/;
# Miscellaneous
@@ -53,10 +54,10 @@
$outfile = "mdgrep.h";
sub start_file {
($rev) = ('$NHDT-Revision: 1.20 $') =~ m/: (.*) .$/;
my $date = '$NHDT-Date: 1596498261 2020/08/03 23:44:21 $';
my $branch = '$NHDT-Branch: NetHack-3.7 $';
my $revision = '$NHDT-Revision: 1.20 $';
($rev) = ('$NHDT-Revision: 1.24 $') =~ m/: (.*) .$/;
my $date = '$NHDT-Date: 1693083351 2023/08/26 20:55:51 $';
my $branch = '$NHDT-Branch: keni-crashweb2 $';
my $revision = '$NHDT-Revision: 1.24 $';
open(OUT, ">$outfile") || die "open $outfile: $!";
# NB: Date and Revision below will be modified when mdgrep.h is written to
# git - this is correct (but it means you must commit changes to mdgrep.pl

View File

@@ -1,2 +1,3 @@
*.applescript NHSUBST
*.JavaScript NHSUBST
* NH_filestag=(file%s_for_macosx_versions)

View File

@@ -0,0 +1,28 @@
#!/usr/bin/osascript -l JavaScript
// NetHack 3.7 tile.h $NHDT-Date: 1693083762 2023/08/26 21:02:42 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.1 $
// Copyright (c) 2023 Kenneth Lorber
// NetHack may be freely redistributed. See license for details.
// Call with URL then field value pairs. Opens a new browser window
// to: URL?field=value+field=value.....
// This program encodes the values; fieldnames don't require encoding.
// Should be installed in the playground.
function run(argv){
var url = argv[0];
var argcp = 1;
url += "?cos=1"; // Start the query string and set mode
while(argcp < argv.length){
url += "&" + argv[argcp] + "=" + encodeURIComponent(argv[argcp+1])
argcp += 2;
}
var safari = Application('Safari');
var nw = safari.make({ new:"document" });
nw.url = url;
safari.activate();
}

View File

@@ -1,2 +1,3 @@
tile.doc NHSUBST
*.lua NHSUBST
* NH_filestag=(file%s_for_versions_using_optional_tiles)

38
win/share/nhcrashreport.lua Executable file
View File

@@ -0,0 +1,38 @@
#!./nhlua
-- NetHack 3.7 nhcrashreport.lua $NHDT-Date: 1693083824 2023/08/26 21:03:44 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.0 $
-- Copyright (c) 2023 Kenneth Lorber
-- NetHack may be freely redistributed. See license for details.
-- Call with URL then field value pairs. Opens a new browser window
-- to: URL?field=value+field=value.....
-- This program encodes the values; fieldnames don't require encoding.
--
-- Should be installed in the playground.
----
-- from
-- https://github.com/daurnimator/lua-http/blob/master/http/util.lua
-- Encodes a character as a percent encoded string
local function char_to_pchar(c)
return string.format("%%%02X", c:byte(1,1))
end
-- encodeURIComponent escapes all characters except the following: alphabetic, decimal digits, - _ . ! ~ * ' ( )
local function encodeURIComponent(str)
return (str:gsub("[^%w%-_%.%!%~%*%'%(%)]", char_to_pchar))
end
----
function un20(str)
return str:gsub("%%20","+")
end
url = table.remove(arg,1) .. "?cos=1"; -- Start the query string and set mode
while #arg > 0 do
local field = table.remove(arg,1)
local value = table.remove(arg,1)
url = url .. "&" .. field .. "=" .. un20(encodeURIComponent(value))
end
--print("url='"..url.."'")
cmd = '/usr/bin/xdg-open "'..url..'"'
os.execute(cmd)
os.exit()

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 NetHackW.c $NHDT-Date: 1596498365 2020/08/03 23:46:05 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.72 $ */
/* NetHack 3.7 NetHackW.c $NHDT-Date: 1693359674 2023/08/30 01:41:14 $ $NHDT-Branch: keni-crashweb2 $:$NHDT-Revision: 1.79 $ */
/* Copyright (C) 2001 by Alex Kompel */
/* NetHack may be freely redistributed. See license for details. */
@@ -123,7 +123,7 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine,
windowprocs.win_wait_synch = mswin_wait_synch;
win10_init();
early_init();
early_init(0, NULL); /* Change as needed to support CRASHREPORT */
/* init application structure */
_nethack_app.hApp = hInstance;