return 0;
}
+/* the '/' command */
int
dowhatis()
{
return do_look(0,(coord *)0);
}
+/* the ';' command */
int
doquickwhatis()
{
return do_look(1,(coord *)0);
}
+/* the '^' command */
int
doidtrap()
{
}
putstr(cwin, 0, "To contact the NetHack development team directly,");
/*XXX overflow possibilities*/
- Sprintf(buf, " see the Contact form on our website or email %s",
+ Sprintf(buf, "see the Contact form on our website or email %s",
DEVTEAM_EMAIL);
putstr(cwin, 0, buf);
putstr(cwin, 0, "");
/* data for help_menu() */
static const char *help_menu_items[] = {
-/* 0*/ "Long description of the game and commands.",
-/* 1*/ "List of game commands.",
-/* 2*/ "Concise history of NetHack.",
-/* 3*/ "Info on a character in the game display.",
-/* 4*/ "Info on what a given key does.",
-/* 5*/ "List of game options.",
-/* 6*/ "Longer explanation of game options.",
-/* 7*/ "List of extended commands.",
-/* 8*/ "The NetHack license.",
-/* 9*/ "Support information.",
+/* 0*/ "About NetHack (version information).",
+/* 1*/ "Long description of the game and commands.",
+/* 2*/ "List of game commands.",
+/* 3*/ "Concise history of NetHack.",
+/* 4*/ "Info on a character in the game display.",
+/* 5*/ "Info on what a given key does.",
+/* 6*/ "List of game options.",
+/* 7*/ "Longer explanation of game options.",
+/* 8*/ "List of extended commands.",
+/* 9*/ "The NetHack license.",
+/* 10*/ "Support information.",
#ifdef PORT_HELP
"%s-specific help and commands.",
#define PORT_HELP_ID 100
-#define WIZHLP_SLOT 11
+#define WIZHLP_SLOT 12
#else
-#define WIZHLP_SLOT 10
+#define WIZHLP_SLOT 11
#endif
#ifdef WIZARD
"List of wizard-mode commands.",
return FALSE;
}
+/* the '?' command */
int
dohelp()
{
if (help_menu(&sel)) {
switch (sel) {
- case 0: display_file(HELP, TRUE); break;
- case 1: display_file(SHELP, TRUE); break;
- case 2: (void) dohistory(); break;
- case 3: (void) dowhatis(); break;
- case 4: (void) dowhatdoes(); break;
- case 5: option_help(); break;
- case 6: display_file(OPTIONFILE, TRUE); break;
- case 7: (void) doextlist(); break;
- case 8: display_file(LICENSE, TRUE); break;
- case 9: (void) docontact(); break;
+ case 0: (void) doextversion(); break;
+ case 1: display_file(HELP, TRUE); break;
+ case 2: display_file(SHELP, TRUE); break;
+ case 3: (void) dohistory(); break;
+ case 4: (void) dowhatis(); break;
+ case 5: (void) dowhatdoes(); break;
+ case 6: option_help(); break;
+ case 7: display_file(OPTIONFILE, TRUE); break;
+ case 8: (void) doextlist(); break;
+ case 9: display_file(LICENSE, TRUE); break;
+ case 10: (void) docontact(); break;
#ifdef PORT_HELP
case PORT_HELP_ID: port_help(); break;
#endif
default:
#ifdef WIZARD
- /* handle slot 10 or 11 */
+ /* handle slot 11 or 12 */
display_file(DEBUGHELP, TRUE);
#endif
break;
return 0;
}
+/* the 'V' command; also a choice for '?' */
int
dohistory()
{
/* NetHack 3.5 version.c $Date$ $Revision$ */
-/* SCCS Id: @(#)version.c 3.5 2006/12/11 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
+#include "dlb.h"
#include "date.h"
/*
* All the references to the contents of patchlevel.h have been moved
return buf;
}
+/* the 'v' command */
int
doversion()
{
return 0;
}
+/* the '#version' command; also a choice for '?' */
int
doextversion()
{
- display_file(OPTIONS_USED, TRUE);
+ dlb *f;
+ char *cr, buf[BUFSZ];
+ winid win = create_nhwindow(NHW_TEXT);
+
+ /* instead of using ``display_file(OPTIONS_USED,TRUE)'' we handle
+ the file manually so we can include dynamic version info */
+ putstr(win, 0, getversionstring(buf));
+
+ f = dlb_fopen(OPTIONS_USED, "r");
+ if (!f) {
+ putstr(win, 0, "");
+ Sprintf(buf, "[Configuration '%s' not available?]", OPTIONS_USED);
+ putstr(win, 0, buf);
+ } else {
+ /*
+ * already inserted above:
+ * + outdented program name and version plus build date and time
+ * dat/options; display the contents with lines prefixed by '-' deleted:
+ * - blank-line
+ * - indented program name and version
+ * blank-line
+ * outdented feature header
+ * - blank-line
+ * indented feature list
+ * spread over multiple lines
+ * blank-line
+ * outdented windowing header
+ * - blank-line
+ * indented windowing choices with
+ * optional second line for default
+ * - blank-line
+ * - EOF
+ */
+ boolean prolog = TRUE; /* to skip indented program name */
+
+ while (dlb_fgets(buf, BUFSZ, f)) {
+ if ((cr = index(buf, '\n')) != 0) *cr = 0;
+ if ((cr = index(buf, '\r')) != 0) *cr = 0;
+ if (index(buf, '\t') != 0) (void) tabexpand(buf);
+
+ if (*buf && *buf != ' ') {
+ /* found outdented header; insert a separator since we'll
+ have skipped corresponding blank line inside the file */
+ putstr(win, 0, "");
+ prolog = FALSE;
+ }
+ /* skip blank lines and prolog (progame name plus version) */
+ if (prolog || !*buf) continue;
+
+ putstr(win, 0, buf);
+ }
+ (void) dlb_fclose(f);
+ display_nhwindow(win, FALSE);
+ destroy_nhwindow(win);
+ }
return 0;
}