follow-up for issue #1512
The previous fix, while valid, still prompts for input during early options processing if stdin is a tty. It really shouldn't be doing that during early options such as --showpaths, so alter the placement of the program_state.earlyoptions flag within *main().
This commit is contained in:
+1
-1
@@ -132,7 +132,6 @@ main(int argc, char *argv[])
|
|||||||
program_state.early_options = 1;
|
program_state.early_options = 1;
|
||||||
/* handle -dalthackdir, -s <score stuff>, --version, --showpaths */
|
/* handle -dalthackdir, -s <score stuff>, --version, --showpaths */
|
||||||
early_options(&argc, &argv, &dir);
|
early_options(&argc, &argv, &dir);
|
||||||
program_state.early_options = 0;
|
|
||||||
#ifdef CHDIR
|
#ifdef CHDIR
|
||||||
/*
|
/*
|
||||||
* Change directories before we initialize the window system so
|
* Change directories before we initialize the window system so
|
||||||
@@ -146,6 +145,7 @@ main(int argc, char *argv[])
|
|||||||
#ifdef __linux__
|
#ifdef __linux__
|
||||||
check_linux_console();
|
check_linux_console();
|
||||||
#endif
|
#endif
|
||||||
|
program_state.early_options = 0;
|
||||||
|
|
||||||
initoptions();
|
initoptions();
|
||||||
#ifdef PANICTRACE
|
#ifdef PANICTRACE
|
||||||
|
|||||||
@@ -219,6 +219,8 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
// windowtype = gc.chosen_windowtype;
|
// windowtype = gc.chosen_windowtype;
|
||||||
// windowtype = gc.chosen_windowtype;
|
// windowtype = gc.chosen_windowtype;
|
||||||
|
|
||||||
|
program_state.early_options = 1;
|
||||||
|
|
||||||
#if !defined(MSWIN_GRAPHICS)
|
#if !defined(MSWIN_GRAPHICS)
|
||||||
nethack_enter_consoletty();
|
nethack_enter_consoletty();
|
||||||
consoletty_open(1);
|
consoletty_open(1);
|
||||||
@@ -254,12 +256,10 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
|
|||||||
* which clears out gp.fqn_prefix[] */
|
* which clears out gp.fqn_prefix[] */
|
||||||
// iflags.windowtype_deferred = TRUE;
|
// iflags.windowtype_deferred = TRUE;
|
||||||
|
|
||||||
program_state.early_options = 1;
|
|
||||||
/* if (GUILaunched || IsDebuggerPresent()) */
|
/* if (GUILaunched || IsDebuggerPresent()) */
|
||||||
early_options(&argc, &argv, &dir);
|
early_options(&argc, &argv, &dir);
|
||||||
|
|
||||||
program_state.early_options = 0;
|
program_state.early_options = 0;
|
||||||
|
|
||||||
|
|
||||||
initoptions();
|
initoptions();
|
||||||
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
#if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS)
|
||||||
chdir(gf.fqn_prefix[HACKPREFIX]);
|
chdir(gf.fqn_prefix[HACKPREFIX]);
|
||||||
|
|||||||
+1
-1
@@ -766,7 +766,7 @@ getret(void)
|
|||||||
#if defined(MICRO) || defined(WIN32CON)
|
#if defined(MICRO) || defined(WIN32CON)
|
||||||
getreturn("to continue");
|
getreturn("to continue");
|
||||||
#else
|
#else
|
||||||
if (!isatty(STDIN_FILENO))
|
if (!isatty(STDIN_FILENO) || program_state.early_options)
|
||||||
return;
|
return;
|
||||||
HUPSKIP();
|
HUPSKIP();
|
||||||
xputs("\n");
|
xputs("\n");
|
||||||
|
|||||||
Reference in New Issue
Block a user