Some nttty.c clean-up.

This commit is contained in:
Bart House
2018-05-12 15:58:44 -07:00
parent 3467b9f087
commit 1d31a49661
7 changed files with 412 additions and 462 deletions

View File

@@ -57,12 +57,14 @@ extern void FDECL(nethack_exit, (int));
extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
extern int redirect_stdout; /* from sys/share/pcsys.c */
extern int GUILaunched;
HANDLE hStdOut;
char *NDECL(exename);
char default_window_sys[] = "mswin";
#ifndef WIN32CON
HANDLE hStdOut;
boolean NDECL(fakeconsole);
void NDECL(freefakeconsole);
#endif
#endif
#if defined(MSWIN_GRAPHICS)
extern void NDECL(mswin_destroy_reg);
@@ -93,6 +95,8 @@ char *argv[];
{
boolean resuming;
nethack_enter(argc, argv);
sys_early_init();
#ifdef WIN32
Strcpy(default_window_sys, "tty");
@@ -358,7 +362,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
Strcpy(hackdir, dir);
}
if (argc > 1) {
#if defined(WIN32)
#if defined(WIN32) && !defined(WIN32CON)
int sfd = 0;
boolean tmpconsole = FALSE;
hStdOut = GetStdHandle(STD_OUTPUT_HANDLE);
@@ -368,7 +372,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
* may do a prscore().
*/
if (!strncmp(argv[1], "-s", 2)) {
#if defined(WIN32)
#if defined(WIN32) && !defined(WIN32CON)
#if 0
if (!hStdOut) {
@@ -395,7 +399,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
initoptions();
#endif
prscore(argc, argv);
#ifdef WIN32
#if defined(WIN32) && !defined(WIN32CON)
if (tmpconsole) {
getreturn("to exit");
freefakeconsole();
@@ -421,7 +425,7 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
#endif
nhusage();
#ifdef WIN32
#if defined(WIN32) && !defined(WIN32CON)
if (tmpconsole) {
getreturn("to exit");
freefakeconsole();
@@ -918,7 +922,7 @@ authorize_wizard_mode()
#define PATH_SEPARATOR '\\'
#endif
#ifdef WIN32
#if defined(WIN32) && !defined(WIN32CON)
static char exenamebuf[PATHLEN];
extern HANDLE hConIn;
extern HANDLE hConOut;

File diff suppressed because it is too large Load Diff

View File

@@ -207,7 +207,7 @@ VA_DECL(const char *, s)
/* error() may get called before tty is initialized */
if (iflags.window_inited)
end_screen();
if (!strncmpi(windowprocs.name, "tty", 3)) {
if (windowprocs.name != NULL && !strncmpi(windowprocs.name, "tty", 3)) {
buf[0] = '\n';
(void) vsprintf(&buf[1], s, VA_ARGS);
Strcat(buf, "\n");
@@ -473,9 +473,19 @@ void ntassert_failed(const char * exp, const char * file, int line)
DebugBreak();
}
// strip off the newline
message[strlen(message) - 1] = '\0';
error(message);
}
/* nethack_enter_winnt() is the first thing called from main */
void nethack_enter_winnt()
{
#ifdef WIN32CON
nethack_enter_nttty();
#endif
}
#endif /* WIN32 */
/*winnt.c*/