I wanted to be able to specify -windowtype:foo on the command line so
that I didn't have to use "NETHACKOPTIONS='windowtype:foo' nethack"
and it turned out that such an option already exists, as "-wfoo".
I either never knew about that or had completely forgotten it. Anyway,
this makes specifying windowtype be more versatile.
"-wX11" still works; now "-w X11", "-windowtype=X11", "-windowtype:X11"
work too, with "--" variations of the latter too also supported. The
long name can be truncated to any leading substring of "windowtype",
although it has to be at least "wi" for "--"; "--w" is rejected.
Also, any errors reported while processing the command line are
treated like config file processing errors rather than just delivered
with raw_printf(). On tty at least, they used to vanish when the
screen cleared to start the game, with no chance to read them. Here's
an example from after this change. It sets windowtype to tty and then
overrides that with X11.
|% ./nethack --w:Qt --win tty -wX11 -windowtype
|
|
| * Unknown option: --w:Qt.
| * Window type [nothing] not recognized. Choices are: tty, curses, X11, Qt.
|
|2 errors on command line.
|
|
|Hit return to continue:
This should probably be better integrated with argcheck() or vice
versa but the only change to that was a couple of formatting bits.
Anything that already worked should continue to work just the same,
aside from the improvement to the error feedback.