Bret Lambert wrote:
> Neat, but these:
> 
> > +#define        DEF_PAGER       _PATH_PAGER
> ...
> > +#define        _PATH_PAGER     "/usr/bin/more"
> 
> mean that you're ignoring $PAGER in favor of dictating what to use.

No, that's just the default to be used in case neither HACKPAGER nor
PAGER are set. One problem I've just found, however, is that external
pagers are always called with the program name 'page'. Here's a better
patch:

Index: config.h
===================================================================
RCS file: /cvs/src/games/hack/config.h,v
retrieving revision 1.8
diff -u -r1.8 config.h
--- config.h    19 May 2003 06:30:56 -0000      1.8
+++ config.h    8 Mar 2011 13:28:55 -0000
@@ -93,6 +93,7 @@
  * (This might be preferable for security reasons.)
  * #define DEF_PAGER   ".../mydir/mypager"
  */
+#define        DEF_PAGER       _PATH_PAGER
 
 /*
  * If you define MAIL, then the player will be notified of new mail
Index: hack.pager.c
===================================================================
RCS file: /cvs/src/games/hack/hack.pager.c,v
retrieving revision 1.18
diff -u -r1.18 hack.pager.c
--- hack.pager.c        27 Oct 2009 23:59:25 -0000      1.18
+++ hack.pager.c        8 Mar 2011 13:28:55 -0000
@@ -66,6 +66,7 @@
    contact the outside world. */
 
 #include       <sys/types.h>
+#include       <libgen.h>
 #include       <signal.h>
 #include       <stdio.h>
 #include       <stdlib.h>
@@ -145,7 +146,7 @@
        while (fgets(bufr, CO, fp) && (!strip || *bufr == '\t') &&
            !got_intrup) {
                bufr[strcspn(bufr, "\n")] = '\0';
-               if (*bufr == '\0' || page_line(bufr+strip)) {
+               if (page_line(bufr+strip)) {
                        set_pager(2);
                        goto ret;
                }
@@ -381,7 +382,7 @@
                if(dup(fd)) {
                        if(!silent) printf("Cannot open %s as stdin.\n", fnam);
                } else {
-                       execl(catmore, "page", (char *) 0);
+                       execl(catmore, basename(catmore), (char *) 0);
                        if(!silent) printf("Cannot exec %s.\n", catmore);
                }
                exit(1);
Index: pathnames.h
===================================================================
RCS file: /cvs/src/games/hack/pathnames.h,v
retrieving revision 1.3
diff -u -r1.3 pathnames.h
--- pathnames.h 3 Jun 2003 03:01:40 -0000       1.3
+++ pathnames.h 8 Mar 2011 13:28:55 -0000
@@ -33,6 +33,7 @@
  */
 
 #define        _PATH_MAIL      "/usr/bin/mail"
+#define        _PATH_PAGER     "/usr/bin/more"
 #define        _PATH_QUEST     "/var/games/questdir"
 #define        _PATH_HACK      "/var/games/hackdir"
 

-- 
Simon Nicolussi, <simon.nicolu...@student.uibk.ac.at>
http://homepage.uibk.ac.at/~csag9583/

Reply via email to