From a2296d043fa57d94dec833ed0d224b83bbdc79aa Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 19 Dec 2018 06:43:00 -0500 Subject: [PATCH] eliminate sys/share/pcsys.c from Windows build Windows build was actually only using a single function in there, so just add a similar function to sys/winnt/winnt.c and eliminate the need for including sys/share/pcsys.c in the build. --- sys/share/pcsys.c | 26 +++----------------------- sys/winnt/Makefile.msc | 7 +++---- sys/winnt/winnt.c | 20 ++++++++++++++++++++ win/win32/vs2017/NetHack.vcxproj | 1 - win/win32/vs2017/NetHackW.vcxproj | 1 - 5 files changed, 26 insertions(+), 29 deletions(-) diff --git a/sys/share/pcsys.c b/sys/share/pcsys.c index 8a99b181e..14d0e4591 100644 --- a/sys/share/pcsys.c +++ b/sys/share/pcsys.c @@ -3,7 +3,7 @@ /* NetHack may be freely redistributed. See license for details. */ /* - * System related functions for MSDOS, OS/2, TOS, and Windows NT + * System related functions for MSDOS, OS/2, TOS */ #define NEED_VARARGS @@ -28,7 +28,7 @@ #define filesize filesize_nh #endif -#if defined(MICRO) || defined(WIN32) || defined(OS2) +#if defined(MICRO) || defined(OS2) void FDECL(nethack_exit, (int)); #else #define nethack_exit exit @@ -51,11 +51,7 @@ STATIC_DCL boolean NDECL(comspec_exists); #endif #endif -#ifdef WIN32 -extern int GUILaunched; /* from nttty.c */ -#endif - -#if defined(MICRO) || defined(WIN32) +#if defined(MICRO) void flushout() @@ -391,7 +387,6 @@ char *name; return; } -#ifndef WIN32 void getreturn(str) const char *str; @@ -420,7 +415,6 @@ VA_DECL(const char *, fmt) VA_END(); return; } -#endif /* * Follow the PATH, trying to fopen the file. @@ -507,10 +501,8 @@ msexit() flushout(); #ifndef TOS -#ifndef WIN32 enable_ctrlP(); /* in case this wasn't done */ #endif -#endif #ifdef MFLOPPY if (ramdisk) copybones(TOPERM); @@ -526,18 +518,6 @@ msexit() if (colors_changed) restore_colors(); #endif -#endif -#ifdef WIN32 - /* Only if we started from the GUI, not the command prompt, - * we need to get one last return, so the score board does - * not vanish instantly after being created. - * GUILaunched is defined and set in nttty.c. - */ - synch_cursor(); - if (GUILaunched) - getreturn("to end"); - synch_cursor(); - getreturn_enabled = TRUE; #endif wait_synch(); return; diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 19f406a52..292c8b663 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -233,7 +233,7 @@ VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o -VOBJ28 = $(O)win10.o $(O)safeproc.o $(O)windmain.o +VOBJ28 = DLBOBJ = $(O)dlb.o @@ -248,7 +248,8 @@ CURSESOBJ= $(O)cursdial.o $(O)cursinit.o $(O)cursinvt.o $(O)cursmain.o \ $(O)cursmesg.o $(O)cursmisc.o $(O)cursstat.o $(O)curswins.o !ENDIF -SOBJ = $(O)winnt.o $(O)pcsys.o $(SOUND) $(O)nhlan.o +SOBJ = $(O)windmain.o $(O)winnt.o $(O)win10.o \ + $(O)safeproc.o $(O)nhlan.o $(SOUND) OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \ $(VOBJ06) $(VOBJ07) $(VOBJ08) $(VOBJ09) $(VOBJ10) \ @@ -1511,8 +1512,6 @@ $(O)\curswins.c: $(WCURSES)\curswins.c $(WCURSES)\curswins.h $(INCL)\wincurs.h $(O)tos.o: ..\sys\atari\tos.c $(HACK_H) $(INCL)\tcap.h @$(CC) $(cflagsBuild) -Fo$@ ..\sys\atari\tos.c -$(O)pcsys.o: ..\sys\share\pcsys.c $(HACK_H) - @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\pcsys.c $(O)pctty.o: ..\sys\share\pctty.c $(HACK_H) @$(CC) $(cflagsBuild) -Fo$@ ..\sys\share\pctty.c $(O)random.o: ..\sys\share\random.c $(HACK_H) diff --git a/sys/winnt/winnt.c b/sys/winnt/winnt.c index c75e53c47..035ea7457 100644 --- a/sys/winnt/winnt.c +++ b/sys/winnt/winnt.c @@ -660,6 +660,26 @@ const char *window_opt; } return 0; } + +/* + * Add a backslash to any name not ending in /, \ or : There must + * be room for the \ + */ +void +append_slash(name) +char *name; +{ + char *ptr; + + if (!*name) + return; + ptr = name + (strlen(name) - 1); + if (*ptr != '\\' && *ptr != '/' && *ptr != ':') { + *++ptr = '\\'; + *++ptr = '\0'; + } + return; +} #endif /* WIN32 */ /*winnt.c*/ diff --git a/win/win32/vs2017/NetHack.vcxproj b/win/win32/vs2017/NetHack.vcxproj index d5feb73b7..ee086fcc5 100644 --- a/win/win32/vs2017/NetHack.vcxproj +++ b/win/win32/vs2017/NetHack.vcxproj @@ -151,7 +151,6 @@ - diff --git a/win/win32/vs2017/NetHackW.vcxproj b/win/win32/vs2017/NetHackW.vcxproj index 79a25df44..93c2e447b 100644 --- a/win/win32/vs2017/NetHackW.vcxproj +++ b/win/win32/vs2017/NetHackW.vcxproj @@ -146,7 +146,6 @@ - -- 2.40.0