summaryrefslogtreecommitdiff
path: root/games/hack
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2011-03-16 18:11:38 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2011-03-16 18:11:38 +0000
commitf84ccaff796670c214ed49ff906b1808c240909a (patch)
treec6e5599e17bfa0c814c492d3d1407066cad042f9 /games/hack
parent070492cde76e006f968fb3d99342a0bf38cf7c41 (diff)
Use the help pager code, but repair it in various ways.
(I had to fix the $PAGER support beyond the patch supplied by Simon) from Simon.Nicolussi@student.uibk.ac.at
Diffstat (limited to 'games/hack')
-rw-r--r--games/hack/config.h3
-rw-r--r--games/hack/hack.pager.c9
-rw-r--r--games/hack/pathnames.h3
3 files changed, 9 insertions, 6 deletions
diff --git a/games/hack/config.h b/games/hack/config.h
index 96e0782309f..8658e884173 100644
--- a/games/hack/config.h
+++ b/games/hack/config.h
@@ -1,4 +1,4 @@
-/* * $OpenBSD: config.h,v 1.8 2003/05/19 06:30:56 pjanzen Exp $*/
+/* * $OpenBSD: config.h,v 1.9 2011/03/16 18:11:37 deraadt Exp $*/
/* * $NetBSD: config.h,v 1.3 1995/03/23 08:29:15 cgd Exp $*/
/*
@@ -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
diff --git a/games/hack/hack.pager.c b/games/hack/hack.pager.c
index 3625f7c3f23..a19d2bf0bb9 100644
--- a/games/hack/hack.pager.c
+++ b/games/hack/hack.pager.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hack.pager.c,v 1.18 2009/10/27 23:59:25 deraadt Exp $ */
+/* $OpenBSD: hack.pager.c,v 1.19 2011/03/16 18:11:37 deraadt Exp $ */
/*
* Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica,
@@ -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 @@ page_more(FILE *fp, int strip)
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 @@ page_file(char *fnam, boolean silent)
if(dup(fd)) {
if(!silent) printf("Cannot open %s as stdin.\n", fnam);
} else {
- execl(catmore, "page", (char *) 0);
+ execlp(catmore, basename(catmore), (char *) 0);
if(!silent) printf("Cannot exec %s.\n", catmore);
}
exit(1);
@@ -415,7 +416,7 @@ dosh()
if(child(0)) {
if ((str = getenv("SHELL")))
- execl(str, str, (char *) 0);
+ execlp(str, str, (char *) 0);
else
execl("/bin/sh", "sh", (char *) 0);
pline("sh: cannot execute.");
diff --git a/games/hack/pathnames.h b/games/hack/pathnames.h
index 54f4c2e7341..7854fcade99 100644
--- a/games/hack/pathnames.h
+++ b/games/hack/pathnames.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: pathnames.h,v 1.3 2003/06/03 03:01:40 millert Exp $ */
+/* $OpenBSD: pathnames.h,v 1.4 2011/03/16 18:11:37 deraadt Exp $ */
/* $NetBSD: pathnames.h,v 1.3 1995/03/23 08:32:27 cgd Exp $ */
/*-
@@ -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"