1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

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()
This commit is contained in:
Andrey A. Chernov 1997-09-24 12:29:25 +00:00
parent fd2fc75769
commit 0f8da203cb
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=29803
6 changed files with 27 additions and 18 deletions

View File

@ -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* \

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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 */

View File

@ -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) {

View File

@ -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) {