summaryrefslogtreecommitdiffstats
path: root/games/hack
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>1997-09-24 12:29:25 +0000
committerache <ache@FreeBSD.org>1997-09-24 12:29:25 +0000
commit60b87f45b8dc096e46f9d939d69ea6893ecbbe35 (patch)
tree452f57474978a539dd7516de6e9c48ba5169b4c2 /games/hack
parent73e522e820d1cc22d5b1a2b2c9d21cba5a3151ef (diff)
downloadFreeBSD-src-60b87f45b8dc096e46f9d939d69ea6893ecbbe35.zip
FreeBSD-src-60b87f45b8dc096e46f9d939d69ea6893ecbbe35.tar.gz
Includes cleanup
Fix nonull flag detecting from termcap Use usleep to handle nonull case Prevent overflow on genocided getenv Install most files not owned by games.games to prevent data modifications Fix path for gethdate()
Diffstat (limited to 'games/hack')
-rw-r--r--games/hack/Makefile8
-rw-r--r--games/hack/hack.main.c4
-rw-r--r--games/hack/hack.options.c2
-rw-r--r--games/hack/hack.termcap.c15
-rw-r--r--games/hack/hack.u_init.c2
-rw-r--r--games/hack/hack.unix.c14
6 files changed, 27 insertions, 18 deletions
diff --git a/games/hack/Makefile b/games/hack/Makefile
index 89c2690..2ab7d77 100644
--- a/games/hack/Makefile
+++ b/games/hack/Makefile
@@ -35,13 +35,13 @@ makedefs: makedefs.c
${CC} ${CFLAGS} -o ${.TARGET} ${.CURDIR}/${.PREFIX}.c
beforeinstall:
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
+ ${INSTALL} -c -o bin -g bin -m ${NOBINMODE} /dev/null \
${DESTDIR}/var/games/hackdir/perm
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 664 /dev/null \
+ ${INSTALL} -c -o bin -g ${BINGRP} -m 464 /dev/null \
${DESTDIR}/var/games/hackdir/record
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m 660 ${.CURDIR}/rumors \
+ ${INSTALL} -c -o bin -g ${BINGRP} -m 440 ${.CURDIR}/rumors \
${DESTDIR}/var/games/hackdir/rumors
- ${INSTALL} -c -o ${BINOWN} -g ${BINGRP} -m ${NOBINMODE} \
+ ${INSTALL} -c -o bin -g bin -m ${NOBINMODE} \
${.CURDIR}/help ${.CURDIR}/hh ${.CURDIR}/data \
${DESTDIR}/var/games/hackdir
rm -f ${DESTDIR}/var/games/hackdir/bones* \
diff --git a/games/hack/hack.main.c b/games/hack/hack.main.c
index fa66e27..956b163 100644
--- a/games/hack/hack.main.c
+++ b/games/hack/hack.main.c
@@ -15,7 +15,7 @@
extern char plname[PL_NSIZ], pl_character[PL_CSIZ];
extern struct permonst mons[CMNUM+2];
-extern char genocided[], fut_geno[];
+extern char genocided[60], fut_geno[];
int (*afternmv)();
int (*occupation)();
@@ -234,7 +234,7 @@ char *argv[];
}
*gp = 0;
} else
- (void) strcpy(genocided, sfoo);
+ (void) strncpy(genocided, sfoo, sizeof(genocided)-1);
(void) strcpy(fut_geno, genocided);
}
}
diff --git a/games/hack/hack.options.c b/games/hack/hack.options.c
index 477d08b..1fd754a 100644
--- a/games/hack/hack.options.c
+++ b/games/hack/hack.options.c
@@ -1,6 +1,7 @@
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* hack.options.c - version 1.0.3 */
+#include <stdlib.h>
#include "config.h"
#include "hack.h"
extern char *eos();
@@ -8,7 +9,6 @@ extern char *eos();
initoptions()
{
register char *opts;
- extern char *getenv();
flags.time = flags.nonews = flags.notombstone = flags.end_own =
flags.standout = flags.nonull = FALSE;
diff --git a/games/hack/hack.termcap.c b/games/hack/hack.termcap.c
index 6b1f9a6..c24dc83 100644
--- a/games/hack/hack.termcap.c
+++ b/games/hack/hack.termcap.c
@@ -2,9 +2,11 @@
/* hack.termcap.c - version 1.0.3 */
#include <stdio.h>
+#include <termcap.h>
+#include <stdlib.h>
+#include <unistd.h>
#include "config.h" /* for ROWNO and COLNO */
#include "def.flag.h" /* for flags.nonull */
-extern char *tgetstr(), *tgoto(), *getenv();
extern long *alloc();
#ifndef lint
@@ -30,10 +32,10 @@ startup()
tbufptr = tbuf;
if(!(term = getenv("TERM")))
error("Can't get TERM.");
- if(!strncmp(term, "5620", 4))
- flags.nonull = 1; /* this should be a termcap flag */
if(tgetent(tptr, term) < 1)
error("Unknown terminal type: %s.", term);
+ if(tgetflag("NP") || tgetflag("nx"))
+ flags.nonull = 1;
if(pc = tgetstr("pc", &tbufptr))
PC = *pc;
if(!(BC = tgetstr("bc", &tbufptr))) {
@@ -244,7 +246,11 @@ delay_output() {
/* cbosgd!cbcephus!pds for SYS V R2 */
/* is this terminfo, or what? */
/* tputs("$<50>", 1, xputc); */
-
+ else {
+ (void) fflush(stdout);
+ usleep(500000);
+ }
+#if 0
else if(ospeed > 0 || ospeed < SIZE(tmspc10)) if(CM) {
/* delay by sending cm(here) an appropriate number of times */
register int cmlen = strlen(tgoto(CM, curx-1, cury-1));
@@ -255,6 +261,7 @@ delay_output() {
i -= cmlen*tmspc10[ospeed];
}
}
+#endif
}
cl_eos() /* free after Robert Viduya */
diff --git a/games/hack/hack.u_init.c b/games/hack/hack.u_init.c
index bc06fa5..cb8a97d 100644
--- a/games/hack/hack.u_init.c
+++ b/games/hack/hack.u_init.c
@@ -4,6 +4,7 @@
#include "hack.h"
#include <stdio.h>
#include <signal.h>
+#include <stdlib.h>
#define Strcpy (void) strcpy
#define Strcat (void) strcat
#define UNDEF_TYP 0
@@ -307,7 +308,6 @@ extern struct obj *mkobj();
#ifdef WIZARD
wiz_inv(){
register struct trobj *trop = &Extra_objs[0];
-extern char *getenv();
register char *ep = getenv("INVENT");
register int type;
while(ep && *ep) {
diff --git a/games/hack/hack.unix.c b/games/hack/hack.unix.c
index 88ebdd6..10a8198 100644
--- a/games/hack/hack.unix.c
+++ b/games/hack/hack.unix.c
@@ -85,12 +85,13 @@ struct stat buf, hbuf;
gethdate(name) char *name; {
/* old version - for people short of space */
-/*
- * register char *np;
- * if(stat(name, &hbuf))
- * error("Cannot get status of %s.",
- * (np = rindex(name, '/')) ? np+1 : name);
- */
+register char *np;
+
+ name = "/usr/games/hide/hack";
+ if(stat(name, &hbuf))
+ error("Cannot get status of %s.",
+ (np = rindex(name, '/')) ? np+1 : name);
+#if 0
/* version using PATH from: seismo!gregc@ucsf-cgl.ARPA (Greg Couch) */
@@ -124,6 +125,7 @@ char filename[MAXPATHLEN+1];
}
error("Cannot get status of %s.",
(np = rindex(name, '/')) ? np+1 : name);
+#endif
}
uptodate(fd) {
OpenPOWER on IntegriCloud