mirror of
https://github.com/vattam/BSDGames.git
synced 2025-12-21 11:24:49 +00:00
This commit was manufactured by cvs2svn to create tag
'debian_version_2_14-8'. git-svn-id: file:///srv/svn/joey/bsdgames-tags/debian_version_2_14-8@5231 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
@@ -1,14 +1,18 @@
|
||||
# $NetBSD: Makefile,v 1.7 1998/02/18 22:37:31 jtc Exp $
|
||||
# $NetBSD: Makefile,v 1.9 1999/02/13 02:54:20 lukem Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/11/93
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
PROG= boggle
|
||||
SRCS= bog.c help.c mach.c prtable.c timer.c word.c
|
||||
DPADD= ${LIBCURSES}
|
||||
LDADD= -lcurses
|
||||
HIDEGAME=hidegame
|
||||
MAN= boggle.6
|
||||
.if ${MKSHARE} != "no"
|
||||
FILES= helpfile
|
||||
FILESDIR=/usr/share/games/boggle
|
||||
.endif
|
||||
|
||||
.include "../../Makefile.inc"
|
||||
.include <bsd.prog.mk>
|
||||
|
||||
@@ -1,4 +1,30 @@
|
||||
# Makefrag - makefile fragment for boggle/boggle
|
||||
#
|
||||
# Copyright (c) 1997, 1998 Joseph Samuel Myers.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 3. The name of the author may not be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
||||
# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
||||
# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
# Defining NEW_STYLE causes this program to be compiled with the Linux
|
||||
# improvements; removing this definition gives the original BSD behaviour.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: bog.c,v 1.9 1998/08/30 09:19:36 veego Exp $ */
|
||||
/* $NetBSD: bog.c,v 1.16 2000/05/08 07:56:02 mycroft Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)bog.c 8.2 (Berkeley) 5/4/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: bog.c,v 1.9 1998/08/30 09:19:36 veego Exp $");
|
||||
__RCSID("$NetBSD: bog.c,v 1.16 2000/05/08 07:56:02 mycroft Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -526,7 +526,7 @@ validword(word)
|
||||
const char *q, *w;
|
||||
|
||||
j = word[0] - 'a';
|
||||
if (dictseek(dictfp, dictindex[j].start, 0) < 0) {
|
||||
if (dictseek(dictfp, dictindex[j].start, SEEK_SET) < 0) {
|
||||
(void) fprintf(stderr, "Seek error\n");
|
||||
cleanup();
|
||||
exit(1);
|
||||
@@ -567,7 +567,7 @@ checkdict()
|
||||
prevch ='a';
|
||||
qi = &wordpath[MAXWORDLEN + 1];
|
||||
|
||||
(void) dictseek(dictfp, 0L, 0);
|
||||
(void) dictseek(dictfp, 0L, SEEK_SET);
|
||||
while ((w = nextword(dictfp)) != NULL) {
|
||||
if (wordlen < minlength)
|
||||
continue;
|
||||
@@ -594,7 +594,7 @@ checkdict()
|
||||
*/
|
||||
if (i != previndex + 1) {
|
||||
if (dictseek(dictfp,
|
||||
dictindex[i].start, 0) < 0) {
|
||||
dictindex[i].start, SEEK_SET) < 0) {
|
||||
warnx("seek error in checkdict()");
|
||||
cleanup();
|
||||
exit(1);
|
||||
@@ -623,7 +623,7 @@ checkdict()
|
||||
}
|
||||
mword[nmwords++] = mwordsp;
|
||||
p = w;
|
||||
while ((*mwordsp++ = *p++))
|
||||
while ((*mwordsp++ = *p++) != '\0')
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.4 1998/09/13 15:27:26 hubertf Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.6 1999/09/09 17:30:18 jsm Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: help.c,v 1.3 1997/10/10 12:04:26 lukem Exp $ */
|
||||
/* $NetBSD: help.c,v 1.4 2001/02/05 00:27:35 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)help.c 8.1 (Berkeley) 6/11/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: help.c,v 1.3 1997/10/10 12:04:26 lukem Exp $");
|
||||
__RCSID("$NetBSD: help.c,v 1.4 2001/02/05 00:27:35 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -51,10 +51,10 @@ __RCSID("$NetBSD: help.c,v 1.3 1997/10/10 12:04:26 lukem Exp $");
|
||||
#include "bog.h"
|
||||
#include "extern.h"
|
||||
|
||||
extern int nlines;
|
||||
int
|
||||
help()
|
||||
{
|
||||
extern int nlines;
|
||||
int eof, i;
|
||||
FILE *fp;
|
||||
WINDOW *win;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mach.c,v 1.8 1997/10/13 21:09:59 cjs Exp $ */
|
||||
/* $NetBSD: mach.c,v 1.11 2001/02/05 00:27:35 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)mach.c 8.1 (Berkeley) 6/11/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: mach.c,v 1.8 1997/10/13 21:09:59 cjs Exp $");
|
||||
__RCSID("$NetBSD: mach.c,v 1.11 2001/02/05 00:27:35 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -72,6 +72,10 @@ int ncols, nlines;
|
||||
|
||||
extern const char *pword[], *mword[];
|
||||
extern int ngames, nmwords, npwords, tnmwords, tnpwords;
|
||||
extern char board[];
|
||||
extern int usedbits, wordpath[];
|
||||
extern time_t start_t;
|
||||
extern int debug;
|
||||
|
||||
static void cont_catcher __P((int));
|
||||
static int prwidth __P((const char *const [], int));
|
||||
@@ -91,8 +95,6 @@ setup(sflag, seed)
|
||||
int sflag;
|
||||
time_t seed;
|
||||
{
|
||||
extern int debug;
|
||||
|
||||
if (tty_setup() < 0)
|
||||
return(-1);
|
||||
|
||||
@@ -293,7 +295,6 @@ static int gone;
|
||||
void
|
||||
stoptime()
|
||||
{
|
||||
extern time_t start_t;
|
||||
time_t t;
|
||||
|
||||
(void)time(&t);
|
||||
@@ -306,7 +307,6 @@ stoptime()
|
||||
void
|
||||
starttime()
|
||||
{
|
||||
extern time_t start_t;
|
||||
time_t t;
|
||||
|
||||
(void)time(&t);
|
||||
@@ -408,9 +408,6 @@ findword()
|
||||
{
|
||||
int c, col, found, i, r, row;
|
||||
char buf[MAXWORDLEN + 1];
|
||||
extern char board[];
|
||||
extern int usedbits, wordpath[];
|
||||
extern int nmwords, npwords;
|
||||
|
||||
getyx(stdscr, r, c);
|
||||
getword(buf);
|
||||
@@ -598,7 +595,7 @@ tty_setup()
|
||||
|
||||
static void
|
||||
stop_catcher(signo)
|
||||
int signo __attribute__((unused));
|
||||
int signo __attribute__((__unused__));
|
||||
{
|
||||
sigset_t sigset, osigset;
|
||||
|
||||
@@ -619,7 +616,7 @@ stop_catcher(signo)
|
||||
|
||||
static void
|
||||
cont_catcher(signo)
|
||||
int signo __attribute__((unused));
|
||||
int signo __attribute__((__unused__));
|
||||
{
|
||||
noecho();
|
||||
raw();
|
||||
@@ -635,7 +632,7 @@ cont_catcher(signo)
|
||||
*/
|
||||
static void
|
||||
winch_catcher(signo)
|
||||
int signo __attribute__((unused));
|
||||
int signo __attribute__((__unused__));
|
||||
{
|
||||
/*
|
||||
struct winsize win;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $ */
|
||||
/* $NetBSD: prtable.c,v 1.6 2000/03/13 22:49:31 soren Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -40,7 +40,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: prtable.c,v 1.4 1997/10/11 02:12:17 lukem Exp $");
|
||||
__RCSID("$NetBSD: prtable.c,v 1.6 2000/03/13 22:49:31 soren Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <curses.h>
|
||||
@@ -63,7 +63,7 @@ static int get_maxlen __P((const char *const [], int, int (*)(const char *const
|
||||
* length - address of the routine to call to determine the length
|
||||
* of string to be printed
|
||||
*
|
||||
* prtable and length are called with the the address of the base and
|
||||
* prtable and length are called with the address of the base and
|
||||
* an index
|
||||
*/
|
||||
void
|
||||
|
||||
@@ -1,126 +0,0 @@
|
||||
/* $NetBSD: timer.c,v 1.4 1997/10/10 12:04:36 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to Berkeley by
|
||||
* Barry Brachman.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. All advertising materials mentioning features or use of this software
|
||||
* must display the following acknowledgement:
|
||||
* This product includes software developed by the University of
|
||||
* California, Berkeley and its contributors.
|
||||
* 4. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)timer.c 8.2 (Berkeley) 2/22/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: timer.c,v 1.4 1997/10/10 12:04:36 lukem Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/time.h>
|
||||
|
||||
#include <curses.h>
|
||||
#include <setjmp.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "bog.h"
|
||||
#include "extern.h"
|
||||
|
||||
static int waitch __P((long));
|
||||
|
||||
/*
|
||||
* Update the display of the remaining time while waiting for a character
|
||||
* If time runs out do a longjmp() to the game controlling routine, returning
|
||||
* non-zero; oth. return the character
|
||||
* Leave the cursor where it was initially
|
||||
*/
|
||||
int
|
||||
timerch()
|
||||
{
|
||||
extern int tlimit;
|
||||
extern time_t start_t;
|
||||
extern jmp_buf env;
|
||||
time_t prevt, t;
|
||||
int col, remaining, row;
|
||||
|
||||
getyx(stdscr, row, col);
|
||||
prevt = 0L;
|
||||
for (;;) {
|
||||
if (waitch(1000L) == 1)
|
||||
break;
|
||||
time(&t);
|
||||
if (t == prevt)
|
||||
continue;
|
||||
prevt = t;
|
||||
remaining = tlimit - (int) (t - start_t);
|
||||
if (remaining < 0) {
|
||||
longjmp(env, 1);
|
||||
/*NOTREACHED*/
|
||||
}
|
||||
move(TIMER_LINE, TIMER_COL);
|
||||
printw("%d:%02d", remaining / 60, remaining % 60);
|
||||
move(row, col);
|
||||
refresh();
|
||||
}
|
||||
return (getch() & 0177);
|
||||
}
|
||||
|
||||
/*
|
||||
* Wait up to 'delay' microseconds for input to appear
|
||||
* Returns 1 if input is ready, 0 oth.
|
||||
*/
|
||||
static int
|
||||
waitch(delay)
|
||||
long delay;
|
||||
{
|
||||
fd_set fdbits;
|
||||
struct timeval duration;
|
||||
|
||||
duration.tv_sec = 0;
|
||||
duration.tv_usec = delay;
|
||||
FD_ZERO(&fdbits);
|
||||
FD_SET(STDIN_FILENO, &fdbits);
|
||||
return (select(32, &fdbits, NULL, NULL, &duration));
|
||||
}
|
||||
|
||||
void
|
||||
delay(tenths)
|
||||
int tenths;
|
||||
{
|
||||
struct timeval duration;
|
||||
|
||||
duration.tv_usec = (tenths % 10 ) * 100000L;
|
||||
duration.tv_sec = (long) (tenths / 10);
|
||||
select(32, 0, 0, 0, &duration);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: word.c,v 1.4 1997/10/11 02:12:18 lukem Exp $ */
|
||||
/* $NetBSD: word.c,v 1.6 2001/02/05 00:27:35 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993
|
||||
@@ -41,7 +41,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)word.c 8.1 (Berkeley) 6/11/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: word.c,v 1.4 1997/10/11 02:12:18 lukem Exp $");
|
||||
__RCSID("$NetBSD: word.c,v 1.6 2001/02/05 00:27:35 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -61,6 +61,9 @@ static char *sp;
|
||||
|
||||
static int first = 1, lastch = 0;
|
||||
|
||||
extern struct dictindex dictindex[];
|
||||
extern int wordlen;
|
||||
|
||||
/*
|
||||
* Return the next word in the compressed dictionary in 'buffer' or
|
||||
* NULL on end-of-file
|
||||
@@ -69,7 +72,6 @@ char *
|
||||
nextword(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
extern int wordlen;
|
||||
int ch, pcount;
|
||||
char *p;
|
||||
static char buf[MAXWORDLEN + 1];
|
||||
@@ -193,7 +195,6 @@ loadindex(indexfile)
|
||||
int i, j;
|
||||
char buf[BUFSIZ];
|
||||
FILE *fp;
|
||||
extern struct dictindex dictindex[];
|
||||
|
||||
if ((fp = fopen(indexfile, "r")) == NULL) {
|
||||
warn("Can't open '%s'", indexfile);
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
a.out
|
||||
*.d
|
||||
*.i
|
||||
*.s
|
||||
*.d.tmp
|
||||
mkdict
|
||||
dictionary
|
||||
@@ -1,7 +0,0 @@
|
||||
a.out
|
||||
*.d
|
||||
*.i
|
||||
*.s
|
||||
*.d.tmp
|
||||
mkindex
|
||||
dictindex
|
||||
Reference in New Issue
Block a user