groundwork for nethackrc name on command line

I've implemented 'nethack -nethackrc=filename' as an alternative to
'NETHACKOPTIONS='@filename' nethack' but at the moment it doesn't
work because the command line parsing comes after the run-time config
file has already been processed.  But this part should work, or maybe
have problems spotted and fixed if it doesn't.  The RC file part of
initoptions_finish() has been rewritten so that it won't need extra
replication of
|  set_error_handling()
|  process_file()
|  reset_error_handling()
|  if (NETHACKOPTIONS) {
|    set_error_handling()
|    process_options()
|    reset_error_handling()
|  }
I've tried to test all the combinations mentioned in the comment but
am not sure that I covered everything, particulary for repeating
earlier tests after making incremental changes.
This commit is contained in:
PatR
2022-02-16 00:36:26 -08:00
parent d958d032a0
commit f588a707bb
3 changed files with 73 additions and 29 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.7 decl.h $NHDT-Date: 1627408982 2021/07/27 18:03:02 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.265 $ */
/* NetHack 3.7 decl.h $NHDT-Date: 1645000560 2022/02/16 08:36:00 $ $NHDT-Branch: NetHack-3.7 $:$NHDT-Revision: 1.283 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/*-Copyright (c) Michael Allison, 2007. */
/* NetHack may be freely redistributed. See license for details. */
@@ -918,6 +918,7 @@ struct instance_globals {
struct rogueroom r[3][3];
/* files.c */
char *cmdline_rcfile; /* set in unixmain.c, used in options.c */
char wizkit[WIZKIT_MAX];
int lockptr;
char *config_section_chosen;