diff --git a/doc/fixes35.0 b/doc/fixes35.0 index f55f7780b..ebd664bd8 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -523,6 +523,7 @@ flexibility for specifying "detect " vs " detection" when wishing when a sokoban puzzle has been completed (last pit or hole filled in), stop assessing luck penalties and lift most movement restrictions '`' command to show discoveries for one class of objects +add "about nethack" to '?' menu as an alternate way to view 'v'+'#version' Platform- and/or Interface-Specific New Features diff --git a/src/pager.c b/src/pager.c index 22cc5accc..446168f36 100644 --- a/src/pager.c +++ b/src/pager.c @@ -774,18 +774,21 @@ do_look(mode, click_cc) 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() { @@ -903,7 +906,7 @@ docontact() } 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, ""); @@ -916,22 +919,23 @@ docontact() /* 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.", @@ -984,6 +988,7 @@ help_menu(sel) return FALSE; } +/* the '?' command */ int dohelp() { @@ -991,22 +996,23 @@ 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; @@ -1015,6 +1021,7 @@ dohelp() return 0; } +/* the 'V' command; also a choice for '?' */ int dohistory() { diff --git a/src/version.c b/src/version.c index 2919759a5..fa2c45bb5 100644 --- a/src/version.c +++ b/src/version.c @@ -1,9 +1,9 @@ /* 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 @@ -40,6 +40,7 @@ char *buf; return buf; } +/* the 'v' command */ int doversion() { @@ -49,10 +50,65 @@ 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; } diff --git a/sys/unix/Makefile.src b/sys/unix/Makefile.src index 25725e6f1..0c923c116 100644 --- a/sys/unix/Makefile.src +++ b/sys/unix/Makefile.src @@ -1,6 +1,5 @@ # NetHack Makefile. # NetHack 3.5 Makefile.src $Date$ $Revision$ -# SCCS Id: @(#)Makefile.src 3.5 2008/01/30 # Root of source tree: NHSROOT=.. @@ -805,7 +804,8 @@ trap.o: trap.c $(HACK_H) u_init.o: u_init.c $(HACK_H) uhitm.o: uhitm.c $(HACK_H) vault.o: vault.c $(HACK_H) -version.o: version.c $(HACK_H) ../include/date.h ../include/patchlevel.h +version.o: version.c $(HACK_H) ../include/dlb.h ../include/date.h \ + ../include/patchlevel.h vision.o: vision.c $(HACK_H) ../include/vis_tab.h weapon.o: weapon.c $(HACK_H) were.o: were.c $(HACK_H) diff --git a/sys/vms/Makefile.src b/sys/vms/Makefile.src index 7e6728f6f..69e23db37 100644 --- a/sys/vms/Makefile.src +++ b/sys/vms/Makefile.src @@ -469,7 +469,7 @@ trap.obj : trap.c $(HACK_H) u_init.obj : u_init.c $(HACK_H) uhitm.obj : uhitm.c $(HACK_H) vault.obj : vault.c $(HACK_H) -version.obj : version.c $(HACK_H) $(INC)date.h $(INC)patchlevel.h +version.obj : version.c $(HACK_H) $(INC)dlb.h $(INC)date.h $(INC)patchlevel.h vision.obj : vision.c $(HACK_H) $(INC)vis_tab.h weapon.obj : weapon.c $(HACK_H) were.obj : were.c $(HACK_H)