early arg support for older platforms

The startup had fallen behind NetHack 5.0 startup for other platforms,
and lacked support for some of the early command line options.

Following this, if PC_EARLY_OPTIONS is defined in pcconf.h, the
port will support those options, such as --version, --showpaths,
--dumpenums, etc.)

Currently, MSDOS #defines's PC_EARLY_OPTIONS, but AMIGA, ATARI,
and MAC68K do not.
This commit is contained in:
nhmall
2026-08-16 07:09:22 -04:00
parent 0a6c355678
commit 9cf2b1bac9
3 changed files with 23 additions and 3 deletions
+5 -1
View File
@@ -148,9 +148,13 @@
LEVELDIR, SAVEDIR, BONESDIR, DATADIR, \
SCOREDIR, LOCKDIR, CONFIGDIR, and TROUBLEDIR. \
*/
#endif /* MSDOS configuration stuff */
/* include early argument processing --dumpenums etc. */
#if defined(MSDOS)
#define PC_EARLY_OPTIONS
#endif
#ifndef PATHLEN
#define PATHLEN 64 /* maximum pathlength */
#endif
+13
View File
@@ -116,6 +116,10 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
startup();
#endif
#if defined(PC_EARLY_OPTIONS)
program_state.early_options = 1;
#endif
#ifdef TOS
if (*argv[0]) { /* only a CLI can give us argv[0] */
gh.hname = argv[0];
@@ -124,6 +128,9 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
#endif
gh.hname = "NetHack"; /* used for syntax messages */
#if defined(PC_EARLY_OPTIONS)
early_init(argc, argv);
#endif
choose_windows(DEFAULT_WINDOW_SYS);
@@ -266,6 +273,12 @@ _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);*/
#endif
ami_wininit_data(WININIT);
#endif
#if defined(PC_EARLY_OPTIONS)
early_options(&argc, &argv, &dir);
program_state.early_options = 0;
#endif
initoptions();
#ifdef NOCWD_ASSUMPTIONS
+5 -2
View File
@@ -155,8 +155,11 @@ getreturn(const char *str)
msmsg("Hit <Enter> %s.", str);
#endif
#endif
while (pgetchar() != '\n')
;
#if defined(PC_EARLY_OPTIONS)
if (isatty(STDOUT_FILENO))
#endif
while (pgetchar() != '\n')
;
return;
}