int locknum; /* max num of simultaneous users */
#endif
#ifdef DEF_PAGER
- char *catmore; /* default pager */
+ const char *catmore; /* external pager; from getenv() or DEF_PAGER */
#endif
#ifdef MICRO
char levels[PATHLEN]; /* where levels are */
/*
* Define DEF_PAGER as your default pager, e.g. "/bin/cat" or "/usr/ucb/more"
* If defined, it can be overridden by the environment variable PAGER.
- * Hack will use its internal pager if DEF_PAGER is not defined.
- * (This might be preferable for security reasons.)
+ * NetHack will use its internal pager if DEF_PAGER is not defined _or_
+ * if DLB is defined since an external pager won't know how to access the
+ * contents of the dlb container file.
+ * (Note: leaving DEF_PAGER undefined is preferable for security reasons.)
*/
-/* #define DEF_PAGER ".../mydir/mypager" */
+/* #define DEF_PAGER "/usr/bin/less" */
/*
* Define PORT_HELP to be the name of the port-specfic help file.
#endif
#ifdef DEF_PAGER
- if (!(g.catmore = nh_getenv("HACKPAGER"))
+ if (!(g.catmore = nh_getenv("NETHACKPAGER"))
+ && !(g.catmore = nh_getenv("HACKPAGER"))
&& !(g.catmore = nh_getenv("PAGER")))
g.catmore = DEF_PAGER;
#endif
#endif
#endif
+#ifdef DEF_PAGER
+ /* DEF_PAGER implies UNIX; when dlb is in use, the only file accessible
+ to an external pager is 'license'; override 'DEF_PAGER' for that
+ situation rather than using code to fallback to DLB plus internal
+ pager after open() failure */
+#ifdef DLB
+#undef DEF_PAGER
+#else
+#ifndef O_RDONLY /* (same logic as unixmain.c) */
+#include <fcntl.h>
+#endif
+#endif /* DLB */
+#endif /* DEF_PAGER */
+
#if defined(TTY_TILES_ESCCODES) || defined(TTY_SOUND_ESCCODES)
#define VT_ANSI_COMMAND 'z'
#endif
#ifdef DEF_PAGER /* this implies that UNIX is defined */
{
/* use external pager; this may give security problems */
- register int fd = open(fname, 0);
+ int fd = open(fname, O_RDONLY);
if (fd < 0) {
if (complain)