Integrate Warp Kit into the NetBSD build

Fix the build and make it install and run with minimal required changes.
This commit is contained in:
kamil 2020-11-10 08:49:08 +00:00
parent 0a8be44c5f
commit 2710a02cd6
19 changed files with 158 additions and 87 deletions

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.1268 2020/11/09 01:05:51 kamil Exp $
# $NetBSD: mi,v 1.1269 2020/11/10 08:49:08 kamil Exp $
#
# Note: Don't delete entries from here - mark them as "obsolete" instead,
# unless otherwise stated below.
@ -2366,6 +2366,7 @@
./usr/share/games/fortune base-games-share
./usr/share/games/larn base-games-share
./usr/share/games/quiz.db base-games-share
./usr/share/games/warp base-games-share
./usr/share/gdb base-util-share
./usr/share/gdb/syscalls base-util-share
./usr/share/gnats base-gnats-share

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.342 2020/10/18 10:10:18 rin Exp $
# $NetBSD: mi,v 1.343 2020/11/10 08:49:09 kamil Exp $
./etc/mtree/set.debug comp-sys-root
./usr/lib comp-sys-usr compatdir
./usr/lib/i18n/libBIG5_g.a comp-c-debuglib debuglib,compatfile
@ -939,6 +939,7 @@
./usr/libdata/debug/usr/games/tetris.debug comp-games-debug debug
./usr/libdata/debug/usr/games/trek.debug comp-games-debug debug
./usr/libdata/debug/usr/games/unstr.debug comp-utils-debug debug
./usr/libdata/debug/usr/games/warp.debug comp-games-debug debug
./usr/libdata/debug/usr/games/worm.debug comp-games-debug debug
./usr/libdata/debug/usr/games/worms.debug comp-games-debug debug
./usr/libdata/debug/usr/games/wump.debug comp-games-debug debug

View File

@ -1,4 +1,4 @@
# $NetBSD: mi,v 1.57 2020/11/09 01:05:51 kamil Exp $
# $NetBSD: mi,v 1.58 2020/11/10 08:49:09 kamil Exp $
#
# Note: don't delete entries from here - mark them as "obsolete" instead.
#
@ -89,6 +89,7 @@
./usr/games/trek games-games-bin
./usr/games/unstr games-utils-bin
./usr/games/wargames games-games-bin
./usr/games/warp games-games-bin
./usr/games/worm games-games-bin
./usr/games/worms games-games-bin
./usr/games/wtf games-utils-bin
@ -254,6 +255,17 @@
./usr/share/man/cat8/dm.0 games-obsolete obsolete
./usr/share/man/cat8/strfile.0 games-obsolete obsolete
./usr/share/man/cat8/unstr.0 games-obsolete obsolete
./usr/share/games/warp/README games-games-share share
./usr/share/games/warp/smap.0 games-games-share share
./usr/share/games/warp/smap.1 games-games-share share
./usr/share/games/warp/smap.2 games-games-share share
./usr/share/games/warp/smap.3 games-games-share share
./usr/share/games/warp/smap.4 games-games-share share
./usr/share/games/warp/smap.5 games-games-share share
./usr/share/games/warp/smap.6 games-games-share share
./usr/share/games/warp/smap.7 games-games-share share
./usr/share/games/warp/warp.doc games-games-share share
./usr/share/games/warp/warp.news games-games-share share
./usr/share/man/html5/dm.conf.html games-games-htmlman html
./usr/share/man/html6/adventure.html games-games-htmlman html
./usr/share/man/html6/arithmetic.html games-games-htmlman html
@ -302,6 +314,7 @@
./usr/share/man/html6/tetris.html games-games-htmlman html
./usr/share/man/html6/trek.html games-games-htmlman html
./usr/share/man/html6/wargames.html games-games-htmlman html
./usr/share/man/html6/warp.html games-games-htmlman html
./usr/share/man/html6/worm.html games-games-htmlman html
./usr/share/man/html6/worms.html games-games-htmlman html
./usr/share/man/html6/wtf.html games-utils-htmlman html
@ -358,6 +371,7 @@
./usr/share/man/man6/tetris.6 games-games-man .man
./usr/share/man/man6/trek.6 games-games-man .man
./usr/share/man/man6/wargames.6 games-games-man .man
./usr/share/man/man6/warp.6 games-games-man .man
./usr/share/man/man6/worm.6 games-games-man .man
./usr/share/man/man6/worms.6 games-games-man .man
./usr/share/man/man6/wtf.6 games-utils-man .man

View File

@ -1,7 +1,7 @@
# $NetBSD: Makefile,v 1.29 2013/11/12 17:46:20 mbalmer Exp $
# $NetBSD: Makefile,v 1.30 2020/11/10 08:49:08 kamil Exp $
# @(#)Makefile 8.3 (Berkeley) 7/24/94
# Missing: dungeon warp
# Missing: dungeon
# Moved: chess
# Don't belong: xneko xroach
@ -14,7 +14,7 @@ SUBDIR= adventure arithmetic atc \
hack hals_end hangman hunt larn mille monop morse number \
phantasia pig pom ppt primes quiz \
rain random robots rogue sail snake tetris trek \
wargames worm worms wtf wump
wargames warp worm worms wtf wump
.if ${MKCXX} != "no"
SUBDIR+= dab

View File

@ -1,61 +1,79 @@
CFLAGS+=-O
# $NetBSD: Makefile,v 1.2 2020/11/10 08:49:08 kamil Exp $
.include <bsd.own.mk>
PROG= warp
SRCS= bang.c init.c intrp.c move.c object.c play.c score.c sig.c term.c \
them.c us.c util.c version.c warp.c weapon.c
OBJS= bang.o init.o intrp.o move.o object.o play.o score.o sig.o term.o \
them.o us.o util.o version.o warp.o weapon.o
warp: ${OBJS}
${CC} ${OBJS} -o $@ -ltermlib -lm
DPADD= ${LIBTERMLIB} ${LIBM} ${LIBCOMPAT}
LDADD= -ltermlib -lm -lcompat
install: warp
export PATH || exit 1
- mv $(bin)/warp $(bin)/warp.old
- if test `pwd` != $(bin); then cp $(public) $(bin); fi
- cd $(bin); chmod 755 $(public); chown '$(CHOWNER)' $(public)
- chmod 4711 $(bin)/warp
- chmod 755 makedir
- ./makedir `./filexp $(privlib)`
- \
if test `pwd` != `./filexp $(privlib)`; then \
cp $(private) `./filexp $(privlib)`; \
fi
- \
cd `./filexp $(privlib)`; \
chmod 755 $(private); \
chown '$(CHOWNER)' . $(private); \
cp /dev/null save.blurfl
- \
if test ! -f `./filexp $(privlib)/warp.news`; then \
cp warp.news `./filexp $(privlib)`; \
fi
- \
if test `pwd` != $(mansrc); then \
for page in $(manpages); do \
cp $$page $(mansrc)/`basename $$page .man`.$(manext); \
done; \
fi
CPPFLAGS+=-DHAVETERMLIB
clean:
rm -f warp core ${OBJS}
CLEANFILES+=sm sm.lo smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
CLEANFILES+=warp.6
HIDEGAME=hidegame
SETGIDGAME=yes
MAN= warp.6
warp.6:
${_MKTARGET_CREATE}
cat ${.CURDIR}/warp.man > ${.TARGET}
DPSRCS+=smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
smap.0: smp.0 sm
sm <smp.0 >smap.0
smap.1: smp.1 sm
sm <smp.1 >smap.1
smap.2: smp.2 sm
sm <smp.2 >smap.2
smap.3: smp.3 sm
sm <smp.3 >smap.3
smap.4: smp.4 sm
sm <smp.4 >smap.4
smap.5: smp.5 sm
sm <smp.5 >smap.5
smap.6: smp.6 sm
sm <smp.6 >smap.6
smap.7: smp.7 sm
sm <smp.7 >smap.7
sm: sm.c
${CC} sm.c -o $@
${_MKTARGET_CREATE}
./sm < ${.CURDIR}/smp.0 > ${.TARGET}
depend: ${SRCS}
mkdep ${SRCS}
smap.1: smp.1 sm
${_MKTARGET_CREATE}
./sm < ${.CURDIR}/smp.1 > ${.TARGET}
smap.2: smp.2 sm
${_MKTARGET_CREATE}
./sm < ${.CURDIR}/smp.2 > ${.TARGET}
smap.3: smp.3 sm
${_MKTARGET_CREATE}
./sm < ${.CURDIR}/smp.3 > ${.TARGET}
smap.4: smp.4 sm
${_MKTARGET_CREATE}
./sm < ${.CURDIR}/smp.4 > ${.TARGET}
smap.5: smp.5 sm
${_MKTARGET_CREATE}
./sm < ${.CURDIR}/smp.5 > ${.TARGET}
smap.6: smp.6 sm
${_MKTARGET_CREATE}
./sm < ${.CURDIR}/smp.6 > ${.TARGET}
smap.7: smp.7 sm
${_MKTARGET_CREATE}
./sm < ${.CURDIR}/smp.7 > ${.TARGET}
sm: sm.lo
${_MKTARGET_LINK}
${HOST_LINK.c} -o ${.TARGET} ${.ALLSRC}
.if ${MKSHARE} != "no"
FILES=smap.0 smap.1 smap.2 smap.3 smap.4 smap.5 smap.6 smap.7
FILES+=warp.doc warp.news README
FILESDIR=/usr/share/games/warp
.endif
CFLAGS+= -Wno-error=old-style-definition -Wno-error=strict-prototypes
CFLAGS+= -Wno-error=comment -Wno-error=maybe-uninitialized
CFLAGS+= -Wno-error=discarded-qualifiers -Wno-error=dangling-else
CFLAGS+= -Wno-error=char-subscripts -Wno-error=parentheses
CFLAGS+= -Wno-error=unused-value -Wno-error=format-extra-args
CFLAGS+= -Wno-error=format-overflow= -Wno-error=builtin-declaration-mismatch
CFLAGS+= -Wno-error=format= -Wno-error=sign-compare -Wno-error=return-type
CFLAGS+= -Wno-error=unused-label -Wno-error=unused-variable
CFLAGS+= -Wno-error=format-nonliteral -Wno-error=implicit-fallthrough=
.include <bsd.prog.mk>

View File

@ -145,5 +145,4 @@
#endif
/* warp private library, may use ~ expansion, %x and %l */
#define PRIVLIB "/usr/games/lib/warp" /**/
#define PRIVLIB "/usr/share/games/warp" /**/

View File

@ -257,6 +257,21 @@ getout:
}
#endif
static char *mygets(char *str, size_t n)
{
char *ret;
size_t last;
if ((ret = fgets(str, n, stdin)) != NULL) {
last = strlen(str) - 1;
if (str[last] == '\n')
str[last] = '\0';
}
return ret;
}
/* interpret interpolations */
char *
@ -367,7 +382,7 @@ char *stoppers;
pattern = dointerp(scrbuf,(sizeof scrbuf),pattern+1,"\"");
fputs(scrbuf,stdout);
resetty();
gets(scrbuf);
mygets(scrbuf, sizeof(scrbuf));
crmode();
raw();
noecho();

View File

@ -35,6 +35,7 @@ score_init()
Reg2 int i;
FILE *savfil;
#if 0
if (stat(SAVEDIR,&filestat)) {
printf("Cannot access %s\r\n",SAVEDIR);
finalize(1);
@ -47,6 +48,7 @@ score_init()
printf("%s is not protected correctly (must be u+rw o+rx).\r\n",SAVEDIR);
finalize(1);
}
#endif
#ifdef SCOREFULL
interp(longlognam, sizeof longlognam, "%N");
@ -535,12 +537,12 @@ score()
Reg1 FILE *logfd;
Reg2 FILE *outfd;
Reg3 int i;
long nowtime, time();
time_t nowtime;
char *scoreboard;
for (i=0; link(LOGFILE, LOCKFILE) == -1 && i<10; i++)
sleep(1);
nowtime = time((long *)0);
nowtime = time(NULL);
strcpy(cdate,ctime(&nowtime));
if ((logfd = fopen(LOGFILE,"a")) != NULL) {
fprintf(logfd,

View File

@ -58,7 +58,7 @@ sig_init()
#ifdef SIGTSTP
void
cont_catcher()
cont_catcher(int x)
{
#ifndef lint
sigset(SIGCONT,cont_catcher);
@ -110,7 +110,7 @@ int status;
/* come here on signal other than interrupt, stop, or cont */
void
sig_catcher(signo)
sig_catcher(int signo)
{
#ifdef VERBOSE
static char *signame[] = {
@ -204,7 +204,7 @@ sig_catcher(signo)
/* come here on stop signal */
void
stop_catcher()
stop_catcher(int sig)
{
if (!waiting) {
resetty(); /* this is the point of all this */

View File

@ -6,10 +6,10 @@
*
*/
void sig_catcher();
void sig_catcher(int);
#ifdef SIGTSTP
void cont_catcher();
void stop_catcher();
void cont_catcher(int);
void stop_catcher(int);
#endif
void mytstp();
void sig_init();

View File

@ -8,8 +8,10 @@
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include "config.h"
int
main()
{
char screen[23][90], buf[10];

View File

@ -556,9 +556,9 @@ rewrite()
display_status();
}
char
int
cmstore(ch)
Reg1 char ch;
Reg1 int ch;
{
*maxcmstring++ = ch;
}

View File

@ -12,6 +12,16 @@
*
*/
#ifndef TERM_H
#define TERM_H
#include "util.h"
/* Compat with old termios. */
#ifndef ECHO
#define ECHO 8
#endif
/* warp will still work without the following, but may get ahead at low speed */
#ifdef TIOCOUTQ /* chars left in output queue */
#define output_pending() (ioctl(1, TIOCOUTQ, &iocount),iocount)
@ -110,7 +120,7 @@ EXT char INTRCH INIT('\03');
# endif /* lint */
# else /* RDCHK */
# ifndef O_NDELAY /* assert O_NDELAY */
??? PENDING isn't defined correctly in warp.h
??? PENDING is not defined correctly in warp.h
# endif
EXT int devtty INIT(0);
# ifndef lint
@ -121,7 +131,7 @@ EXT char INTRCH INIT('\03');
# endif /* RDCHK */
# endif /* FIONREAD */
# else /* PENDING */
??? warp won't work without PENDING
??? warp will not work without PENDING
# ifndef lint
# define input_pending() (nextin!=nextout)
# else
@ -149,7 +159,7 @@ EXT char INTRCH INIT('\03');
# endif /* lint */
# else /* RDCHK */
# ifndef O_NDELAY /* assert O_NDELAY */
??? PENDING isn't defined correctly in warp.h
??? PENDING is not defined correctly in warp.h
# endif
EXT int devtty INIT(0);
EXT bool is_input INIT(FALSE);
@ -163,7 +173,7 @@ EXT char INTRCH INIT('\03');
# endif /* RDCHK */
# endif /* FIONREAD */
# else /* PENDING */
??? warp won't work without PENDING
??? warp will not work without PENDING
# define read_tty(addr,size) read(0,addr,size)
# define input_pending() (FALSE)
# endif /* PENDING */
@ -278,7 +288,6 @@ EXT char KILLCH; /* line delete character */
#define standout() do_tc(SO,1)
#define un_standout() do_tc(SE,1)
#define up_line() do_tc(UP,1)
#define carriage_return() do_tc(CR,1)
#define dingaling() do_tc(VB,1)
#else
???????? /* up to you */
@ -305,4 +314,6 @@ void do_tc();
int comp_tc();
void helper();
void rewrite();
char cmstore();
int cmstore(int);
#endif

View File

@ -97,7 +97,6 @@ safemalloc(size)
MEM_SIZE size;
{
char *ptr;
char *malloc();
ptr = malloc(size?size:1); /* malloc(0) is NASTY on our system */
if (ptr != Nullch)

View File

@ -54,7 +54,7 @@ void movc3();
void no_can_do();
int exdis();
EXT bool waiting INIT(FALSE); /* are we waiting for subprocess (in doshell)? */
#define waiting 0
#ifdef NOTDEF
EXT int len_last_line_got INIT(0);

View File

@ -10,6 +10,8 @@
#include "INTERN.h"
#include "version.h"
#include <stdio.h>
/* Print out the version number. */
void

View File

@ -132,6 +132,7 @@ char rcsid[] = "@(#)Header: warp.c,v 7.0.1.3 86/12/12 17:07:44 lwall Exp";
#include "version.h"
#include "weapon.h"
int
main(argc,argv)
int argc;
char *argv[];

View File

@ -12,16 +12,23 @@
*
*/
#ifndef WARP_H
#define WARP_H
extern int errno;
#include "config.h" /* generated by Configure script */
#include <term.h>
#include <stdio.h>
#include <signal.h>
#include <ctype.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
/* WARPLIB must be readable and writeable by warp, but not by anyone who you
* don't trust. In other words, to set up warp so everyone can play and
@ -32,7 +39,7 @@ extern int errno;
* access.)
*/
#define SAVEDIR "./"
#define SAVEDIR "/var/games"
#define NEWSFILE "warp.news"
#define HELPFILE "warp.doc"
#define LOCKFILE ".warp.lock"
@ -100,6 +107,8 @@ EXT char amb[YSIZE][XSIZE];
#ifdef TERMIO
# include <termio.h>
#elif defined TERMIOS
# include <termios.h>
#else
# include <sgtty.h>
#endif
@ -429,10 +438,6 @@ EXT int ambsize;
EXT char spbuf[512];
char *index(), *ttyname(), *malloc(), *ctime(), *strcpy();
char *getenv(), cmstore(), *tgoto();
long atol();
#define Fclose (void)fclose
#define Fflush (void)fflush
#define Fgets (void)fgets
@ -443,3 +448,5 @@ long atol();
#define Tract (void)tract
#define Make_object (void)make_object
#define Read_tty (void)read_tty
#endif

View File

@ -1,4 +1,3 @@
*** WARP NEWS ***
Welcome to warp! Please send any gripes, comments, fantastic ideas, etc.
to lwall@sdcrdcf.uucp (Larry Wall).
Welcome to warp!