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:
16
dat/usagehlp
16
dat/usagehlp
@@ -61,8 +61,10 @@ nethack --windowtype:Iii
|
||||
designation itself may be any case; variations '--windowtype Iii' and
|
||||
'-w Iii' work too.
|
||||
|
||||
On Windows, nethack.exe might support both tty and curses; nethackW.exe
|
||||
supports mswin only. MS-DOS is tty only.
|
||||
On Windows, nethack.exe supports tty or curses or both depending on
|
||||
settings at the time the program is built from source; nethackW.exe
|
||||
supports mswin (also referred to as Win GUI) and optionally curses.
|
||||
For MS-DOS, the program supports tty or curses or both.
|
||||
|
||||
nethack -n
|
||||
don't show the 'news' file if one is present in nethack's directory.
|
||||
@@ -110,13 +112,15 @@ nethack -dDir -s
|
||||
nethack --directory:Dir -s
|
||||
as above; alternate directory, if specified, should come first.
|
||||
|
||||
nethack --version
|
||||
nethack --version:copy
|
||||
'--version' display the program's version number and exit;
|
||||
nethack --version or --version:copy or --version:dump or --version:show
|
||||
'--version' display the program's version number plus the date and
|
||||
time it was built from source code, then exit;
|
||||
'--version:copy' display version number and also copy it into system
|
||||
pasteboard (should work on macOS and Windows; might not work on other
|
||||
systems) so that it could be pasted from there into a subsequent email
|
||||
or web contact form, then exit.
|
||||
or web contact form, then exit;
|
||||
'--version:dump' display several internal values, then exit;
|
||||
'--version:show' same as '--version'.
|
||||
|
||||
nethack --showpaths
|
||||
list expected locations for various files and directories, then exit;
|
||||
|
||||
@@ -123,8 +123,10 @@ Also
|
||||
[
|
||||
.BR \-\-showpaths
|
||||
]
|
||||
.\" force line wrap now rather than have that happen after the opening brace
|
||||
.br
|
||||
[
|
||||
.BR \-\-version [ :copy ]
|
||||
.BR \-\-version [ :copy | :dump | :show ]
|
||||
]
|
||||
.ad
|
||||
.hy 14
|
||||
@@ -367,17 +369,27 @@ that many top scores.
|
||||
Combining names with role or race or both will report entries which match
|
||||
any of those rather than just the ones which match all.
|
||||
.PP
|
||||
.B \-\-version
|
||||
can be used to cause NetHack to show the version information it
|
||||
was compiled with, then exit.
|
||||
That will include the
|
||||
.I git
|
||||
commit hash if the information was available when the game was compiled.
|
||||
On some platforms, such as Windows and macOS, a variation
|
||||
.B \-\-version:copy
|
||||
.\" avoid hyphenating "version" in this paragraph (and beyond; don't care)
|
||||
.hw version
|
||||
.BR \-\-version " or " \-\-version:show
|
||||
can be used to cause NetHack to show the version number, the date and
|
||||
time that the program was built from its source code, and possibly
|
||||
some auxiliary information about that source code, then exit.
|
||||
The optional auxiliary information is \fIgit\fP
|
||||
commit hash (reflecting the source code's most recent modification when
|
||||
extracted from the \fIgit\fP version control system, if that is in use)
|
||||
if available when the program was built.
|
||||
On some platforms such as Windows and macOS, a variation,
|
||||
.BR \-\-version:copy ,
|
||||
can be used to cause NetHack to show the version information, then exit,
|
||||
while also leaving a copy of the version information in the paste buffer
|
||||
while also leaving a copy of that information in the paste buffer
|
||||
or clipboard for potential insertion into things like bug reports.
|
||||
On any platform,
|
||||
.B \-\-version:dump
|
||||
can be used to show most of the data used when checking whether a save
|
||||
file or bones file is compatible with the program.
|
||||
The program will display a line containing five numbers expressed in
|
||||
hexadecimal, then exit.
|
||||
.PP
|
||||
.B \-\-showpaths
|
||||
can be used to cause NetHack to show where it is expecting
|
||||
|
||||
@@ -3387,6 +3387,7 @@ extern unsigned long get_feature_notice_ver(char *) NO_NNARGS;
|
||||
extern unsigned long get_current_feature_ver(void);
|
||||
extern const char *copyright_banner_line(int) NONNULL;
|
||||
extern void early_version_info(boolean);
|
||||
extern void dump_version_info(void);
|
||||
|
||||
/* ### video.c ### */
|
||||
|
||||
@@ -3791,3 +3792,5 @@ extern void port_insert_pastebuf(char *);
|
||||
#endif /* !MAKEDEFS_C && !MDLIB_C */
|
||||
|
||||
#endif /* EXTERN_H */
|
||||
|
||||
/*extern.h*/
|
||||
|
||||
@@ -936,7 +936,7 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
|
||||
break;
|
||||
}
|
||||
if (idx >= SIZE(earlyopts) || argc < 1)
|
||||
return FALSE;
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < argc; ++i) {
|
||||
if (argv[i][0] != '-')
|
||||
@@ -975,13 +975,21 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
|
||||
than next major version */
|
||||
if (match_optname(extended_opt, "paste", 5, FALSE)) {
|
||||
insert_into_pastebuf = TRUE;
|
||||
} else if(match_optname(extended_opt, "copy", 4, FALSE)) {
|
||||
} else if (match_optname(extended_opt, "copy", 4, FALSE)) {
|
||||
insert_into_pastebuf = TRUE;
|
||||
} else {
|
||||
raw_printf(
|
||||
"-%sversion can only be extended with -%sversion:copy.\n",
|
||||
} else if (match_optname(extended_opt, "dump", 4, FALSE)) {
|
||||
/* version number plus enabled features and sanity
|
||||
values that the program compares against the same
|
||||
thing recorded in save and bones files to check
|
||||
whether they're being used compatibly */
|
||||
dump_version_info();
|
||||
return 2; /* done */
|
||||
} else if (!match_optname(extended_opt, "show", 4, FALSE)) {
|
||||
raw_printf("-%sversion can only be extended with"
|
||||
" -%sversion:copy or :dump or :show.\n",
|
||||
dashdash, dashdash);
|
||||
return TRUE;
|
||||
/* exit after we've reported bad command line argument */
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
early_version_info(insert_into_pastebuf);
|
||||
@@ -1016,7 +1024,7 @@ argcheck(int argc, char *argv[], enum earlyarg e_arg)
|
||||
break;
|
||||
}
|
||||
};
|
||||
return FALSE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -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*/
|
||||
|
||||
Reference in New Issue
Block a user