CROSS_TO_WASM build fix
A couple of option processing functions, one of which was called in file.c, were recently added to sys/unix/unixmain.c, but the wasm build does not include unixmain.c, it uses sys/libnh/libnhmain.c. Transcribe the functions into sys/libnh/libnhmain.c. Also, do not #include "wintty.h" for NOTTYGRAPHICS builds.
This commit is contained in:
@@ -51,6 +51,7 @@ extern void init_linux_cons(void);
|
|||||||
|
|
||||||
static void wd_message(void);
|
static void wd_message(void);
|
||||||
static struct passwd *get_unix_pw(void);
|
static struct passwd *get_unix_pw(void);
|
||||||
|
ATTRNORETURN static void opt_terminate(void) NORETURN;
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
/* if WebAssembly, export this API and don't optimize it out */
|
/* if WebAssembly, export this API and don't optimize it out */
|
||||||
@@ -768,6 +769,32 @@ sys_random_seed(void)
|
|||||||
return seed;
|
return seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* for command-line options that perform some immediate action and then
|
||||||
|
terminate the program without starting play, like 'nethack --version'
|
||||||
|
or 'nethack -s Zelda'; do some cleanup before that termination */
|
||||||
|
ATTRNORETURN static void
|
||||||
|
opt_terminate(void)
|
||||||
|
{
|
||||||
|
config_error_done(); /* free memory allocated by config_error_init() */
|
||||||
|
|
||||||
|
nh_terminate(EXIT_SUCCESS);
|
||||||
|
/*NOTREACHED*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/* show the sysconf file name, playground directory, run-time configuration
|
||||||
|
file name, dumplog file name if applicable, and some other things */
|
||||||
|
ATTRNORETURN void
|
||||||
|
after_opt_showpaths(const char *dir)
|
||||||
|
{
|
||||||
|
#ifdef CHDIR
|
||||||
|
chdirx(dir, FALSE);
|
||||||
|
#else
|
||||||
|
nhUse(dir);
|
||||||
|
#endif
|
||||||
|
opt_terminate();
|
||||||
|
/*NOTREACHED*/
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __EMSCRIPTEN__
|
#ifdef __EMSCRIPTEN__
|
||||||
/***
|
/***
|
||||||
* Helpers
|
* Helpers
|
||||||
|
|||||||
@@ -11,7 +11,9 @@
|
|||||||
|
|
||||||
#define NEED_VARARGS
|
#define NEED_VARARGS
|
||||||
#include "hack.h"
|
#include "hack.h"
|
||||||
|
#if defined(TTY_GRAPHICS) && !defined(NOTTYGRAPHICS)
|
||||||
#include "wintty.h"
|
#include "wintty.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The distinctions here are not BSD - rest but rather USG - rest, as
|
* The distinctions here are not BSD - rest but rather USG - rest, as
|
||||||
|
|||||||
Reference in New Issue
Block a user