nethack --version:dump

Add the 'dump' argument to the existing '--version' command-line
option to display the magic numbers used when validating save and
bones files for compatibility.

Nothing exciting, just a line of 5 hex values.  I was going to also
list the values for however many save and bones files are specified
on the command line but it seems to need more effort than I care to
expend.  And I hadn't made up my mind whether that should be done by
nethack, recover, or some new standalone program.  [Single line of
relatively raw output is so that they could be compared more easily.]

nethack --version:bad-argument was writing a message to stdout and
then starting play--which immediately overwrites stdout.  Have it
quit instead.  Player wasn't trying to start a game and quitting is
what it does with --version:good-argument.
This commit is contained in:
PatR
2024-02-13 15:58:10 -08:00
parent d511944dda
commit bf8a634760
5 changed files with 72 additions and 23 deletions

View File

@@ -485,4 +485,26 @@ copyright_banner_line(int indx)
return "";
}
/* called by argcheck(allmain.c) from early_options(sys/xxx/xxxmain.c) */
void
dump_version_info(void)
{
char buf[BUFSZ];
const char *hname = gh.hname ? gh.hname : "nethack";
if (strlen(hname) > 33)
hname = eos(nhStr(hname)) - 33; /* discard const for eos() */
runtime_info_init();
Snprintf(buf, sizeof buf, "%-12.33s %08lx %08lx %08lx %08lx %08lx",
hname,
nomakedefs.version_number,
(nomakedefs.version_features & ~nomakedefs.ignored_features),
nomakedefs.version_sanity1,
nomakedefs.version_sanity2,
nomakedefs.version_sanity3);
raw_print(buf);
release_runtime_info();
return;
}
/*version.c*/