here's a nickel kid, get a terminal with scrollback...
Index: wump.c
===================================================================
RCS file: /cvs/src/games/wump/wump.c,v
retrieving revision 1.26
diff -u -p -r1.26 wump.c
--- wump.c 29 Aug 2013 20:22:22 -0000 1.26
+++ wump.c 5 Nov 2015 23:10:55 -0000
@@ -858,10 +858,8 @@ int_compare(const void *a, const void *b
void
instructions(void)
{
- const char *pager;
- pid_t pid;
- int status;
- int fd;
+ char buf[1024];
+ FILE *fp;
/*
* read the instructions file, if needed, and show the user how to
@@ -870,34 +868,15 @@ instructions(void)
if (!getans("Instructions? (y-n) "))
return;
- if ((fd = open(_PATH_WUMPINFO, O_RDONLY)) == -1) {
+ if ((fp = fopen(_PATH_WUMPINFO, "r")) == NULL) {
(void)printf(
"Sorry, but the instruction file seems to have disappeared in a\n\
puff of greasy black smoke! (poof)\n");
return;
}
-
- if (!isatty(1))
- pager = "/bin/cat";
- else {
- if (!(pager = getenv("PAGER")) || (*pager == 0))
- pager = _PATH_PAGER;
- }
- switch (pid = fork()) {
- case 0: /* child */
- if (dup2(fd, 0) == -1)
- err(1, "dup2");
- (void)execl(_PATH_BSHELL, "sh", "-c", pager, (char *)NULL);
- err(1, "exec sh -c %s", pager);
- /* NOT REACHED */
- case -1:
- err(1, "fork");
- /* NOT REACHED */
- default:
- (void)waitpid(pid, &status, 0);
- close(fd);
- break;
- }
+ while (fgets(buf, sizeof(buf), fp))
+ fputs(buf, stdout);
+ fclose(fp);
}
void