fix W343-1 open win32 bug from known bugs page
W343-1 Redirecting score output through a pipe doesn't work.
This commit is contained in:
@@ -54,6 +54,7 @@ extern void FDECL(nethack_exit,(int));
|
||||
|
||||
#ifdef WIN32
|
||||
extern boolean getreturn_enabled; /* from sys/share/pcsys.c */
|
||||
extern int redirect_stdout; /* from sys/share/pcsys.c */
|
||||
#endif
|
||||
|
||||
#if defined(MSWIN_GRAPHICS)
|
||||
@@ -227,14 +228,22 @@ char *argv[];
|
||||
* may do a prscore().
|
||||
*/
|
||||
if (!strncmp(argv[1], "-s", 2)) {
|
||||
#if !defined(MSWIN_GRAPHICS)
|
||||
# if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
chdirx(hackdir,0);
|
||||
#if defined(MSWIN_GRAPHICS) || defined(WIN32CON)
|
||||
int sfd = _fileno(stdout);
|
||||
redirect_stdout = (sfd >= 0) ? !isatty(sfd) : 0;
|
||||
|
||||
# ifdef MSWIN_GRAPHICS
|
||||
if (!redirect_stdout) {
|
||||
raw_printf("-s is not supported for the Graphical Interface\n");
|
||||
nethack_exit(EXIT_SUCCESS);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||
chdirx(hackdir,0);
|
||||
#endif
|
||||
prscore(argc, argv);
|
||||
#else
|
||||
raw_printf("-s is not supported for the Graphical Interface\n");
|
||||
#endif /*MSWIN_GRAPHICS*/
|
||||
nethack_exit(EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
|
||||
@@ -390,6 +390,7 @@ char *name;
|
||||
|
||||
#ifdef WIN32
|
||||
boolean getreturn_enabled;
|
||||
int redirect_stdout;
|
||||
#endif
|
||||
|
||||
void
|
||||
|
||||
Reference in New Issue
Block a user