mirror of
https://github.com/vattam/BSDGames.git
synced 2025-12-21 03:14:50 +00:00
Added all debian changes
git-svn-id: file:///srv/svn/joey/bsdgames-trunk@5090 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.7 1998/08/29 22:53:03 hubertf Exp $ */
|
||||
/* $NetBSD: main.c,v 1.8 1998/09/15 13:43:34 frueauf Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1980, 1993
|
||||
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: main.c,v 1.7 1998/08/29 22:53:03 hubertf Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.8 1998/09/15 13:43:34 frueauf Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@@ -177,7 +177,7 @@ main(argc, argv)
|
||||
if (yorn(0)) {
|
||||
|
||||
fixtty(&old); /* restore tty */
|
||||
execl(TEACH, "teachgammon", args, 0);
|
||||
execl(TEACH, "teachgammon", args[1]?args:0, 0);
|
||||
|
||||
tflag = 0; /* error! */
|
||||
writel(noteach);
|
||||
@@ -489,27 +489,37 @@ main(argc, argv)
|
||||
if (tflag)
|
||||
refresh();
|
||||
|
||||
/* backgammon? */
|
||||
mflag = 0;
|
||||
l = bar + 7 * cturn;
|
||||
for (i = bar; i != l; i += cturn)
|
||||
if (board[i] * cturn)
|
||||
mflag++;
|
||||
/*
|
||||
* If any men have been born off, it's a single game,
|
||||
* regardless of where other men are.
|
||||
*/
|
||||
|
||||
if (*offptr > 0) {
|
||||
// Single game.
|
||||
} else {
|
||||
/* backgammon? */
|
||||
mflag = 0;
|
||||
l = bar + 7 * cturn;
|
||||
for (i = bar; i != l; i += cturn)
|
||||
if (board[i] * cturn)
|
||||
mflag++;
|
||||
|
||||
/* compute game value */
|
||||
if (tflag)
|
||||
curmove(20, 0);
|
||||
if (*offopp == 15) {
|
||||
if (mflag) {
|
||||
writel(bgammon);
|
||||
gvalue *= 3;
|
||||
} else
|
||||
if (*offptr <= 0) {
|
||||
writel(gammon);
|
||||
gvalue *= 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* compute game value */
|
||||
if (tflag)
|
||||
curmove(20, 0);
|
||||
if (*offopp == 15) {
|
||||
if (mflag) {
|
||||
writel(bgammon);
|
||||
gvalue *= 3;
|
||||
} else
|
||||
if (*offptr <= 0) {
|
||||
writel(gammon);
|
||||
gvalue *= 2;
|
||||
}
|
||||
}
|
||||
/* report situation */
|
||||
/* report situation */
|
||||
if (cturn == -1) {
|
||||
writel("Red wins ");
|
||||
rscore += gvalue;
|
||||
|
||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,3 +1,9 @@
|
||||
bsdgames (2.6-1) unstable; urgency=low
|
||||
|
||||
* New upstream release.
|
||||
|
||||
-- Joey Hess <joeyh@master.debian.org> Sun, 20 Dec 1998 00:24:18 -0500
|
||||
|
||||
bsdgames (2.5-4) frozen unstable; urgency=low
|
||||
|
||||
* Commented out a bogus sprintf prototype in sail/sync.c, makes sail
|
||||
|
||||
@@ -513,9 +513,9 @@ list_drivers()
|
||||
get_response:
|
||||
namelen = DAEMON_SIZE;
|
||||
errno = 0;
|
||||
wait.tv_sec = 1;
|
||||
wait.tv_usec = 0;
|
||||
for (;;) {
|
||||
wait.tv_sec = 1;
|
||||
wait.tv_usec = 0;
|
||||
if (listc + 1 >= listmax) {
|
||||
listmax += 20;
|
||||
listv = (SOCKET *) realloc((char *) listv,
|
||||
|
||||
@@ -59,10 +59,10 @@ main(ac, av)
|
||||
int ac;
|
||||
char **av;
|
||||
{
|
||||
char *sp;
|
||||
const char *sp;
|
||||
bool bad_arg;
|
||||
bool show_only;
|
||||
extern char *Scorefile;
|
||||
extern const char *Scorefile;
|
||||
extern int Max_per_uid;
|
||||
int score_wfd; /* high score writable file descriptor */
|
||||
int score_err = 0; /* hold errno from score file open */
|
||||
@@ -70,6 +70,8 @@ main(ac, av)
|
||||
score_wfd = open(Scorefile, O_RDWR);
|
||||
if (score_wfd < 0)
|
||||
score_err = errno;
|
||||
else if (score_wfd < 3)
|
||||
exit(1);
|
||||
|
||||
/* Revoke setgid privileges */
|
||||
setregid(getgid(), getgid());
|
||||
|
||||
75
sail/sync.c
75
sail/sync.c
@@ -60,10 +60,12 @@ __RCSID("$NetBSD: sync.c,v 1.10 1998/09/11 14:15:46 hubertf Exp $");
|
||||
|
||||
#define BUFSIZE 4096
|
||||
|
||||
static const char SF[] = _PATH_SYNC;
|
||||
static const char LF[] = _PATH_LOCK;
|
||||
static char sync_buf[BUFSIZE];
|
||||
static char *sync_bp = sync_buf;
|
||||
static char sync_lock[25];
|
||||
static char sync_file[25];
|
||||
static char sync_lock[sizeof SF];
|
||||
static char sync_file[sizeof LF];
|
||||
static long sync_seek;
|
||||
static FILE *sync_fp;
|
||||
|
||||
@@ -122,7 +124,7 @@ makesignal(va_alias)
|
||||
fmtship(format, sizeof(format), fmt, ship);
|
||||
(void) vsprintf(message, format, ap);
|
||||
va_end(ap);
|
||||
Write(W_SIGNAL, from, 1, (long)message, 0, 0, 0);
|
||||
Writestr(W_SIGNAL, from, message);
|
||||
}
|
||||
|
||||
void
|
||||
@@ -147,7 +149,7 @@ makemsg(va_alias)
|
||||
#endif
|
||||
(void) vsprintf(message, fmt, ap);
|
||||
va_end(ap);
|
||||
Write(W_SIGNAL, from, 1, (long)message, 0, 0, 0);
|
||||
Writestr(W_SIGNAL, from, message);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -158,9 +160,8 @@ sync_exists(game)
|
||||
struct stat s;
|
||||
time_t t;
|
||||
|
||||
/* (void) sprintf(buf, _PATH_SYNC, game);*/
|
||||
(void) sprintf(buf, SF, game);
|
||||
(void) time(&t);
|
||||
|
||||
setegid(egid);
|
||||
if (stat(buf, &s) < 0) {
|
||||
setegid(gid);
|
||||
@@ -168,7 +169,7 @@ sync_exists(game)
|
||||
}
|
||||
if (s.st_mtime < t - 60*60*2) { /* 2 hours */
|
||||
(void) unlink(buf);
|
||||
(void) sprintf(buf, _PATH_LOCK, game);
|
||||
(void) sprintf(buf, LF, game);
|
||||
(void) unlink(buf);
|
||||
setegid(gid);
|
||||
return 0;
|
||||
@@ -184,8 +185,8 @@ sync_open()
|
||||
struct stat tmp;
|
||||
if (sync_fp != NULL)
|
||||
(void) fclose(sync_fp);
|
||||
(void) sprintf(sync_lock, _PATH_LOCK, game);
|
||||
(void) sprintf(sync_file, _PATH_SYNC, game);
|
||||
(void) sprintf(sync_lock, LF, game);
|
||||
(void) sprintf(sync_file, SF, game);
|
||||
setegid(egid);
|
||||
if (stat(sync_file, &tmp) < 0) {
|
||||
mode_t omask = umask(002);
|
||||
@@ -214,25 +215,37 @@ sync_close(remove)
|
||||
}
|
||||
|
||||
void
|
||||
Write(type, ship, isstr, a, b, c, d)
|
||||
Write(type, ship, a, b, c, d)
|
||||
int type;
|
||||
struct ship *ship;
|
||||
int isstr;
|
||||
long a, b, c, d;
|
||||
{
|
||||
|
||||
if (isstr)
|
||||
(void) sprintf(sync_bp, "%d %d %d %s\n",
|
||||
type, ship->file->index, isstr, (char *) a);
|
||||
else
|
||||
(void) sprintf(sync_bp, "%d %d %d %ld %ld %ld %ld\n",
|
||||
type, ship->file->index, isstr, a, b, c, d);
|
||||
(void) sprintf(sync_bp, "%d %d 0 %ld %ld %ld %ld\n",
|
||||
type, ship->file->index, a, b, c, d);
|
||||
while (*sync_bp++)
|
||||
;
|
||||
sync_bp--;
|
||||
if (sync_bp >= &sync_buf[sizeof sync_buf])
|
||||
abort();
|
||||
(void) sync_update(type, ship, a, b, c, d);
|
||||
(void) sync_update(type, ship, NULL, a, b, c, d);
|
||||
}
|
||||
|
||||
void
|
||||
Writestr(type, ship, a)
|
||||
int type;
|
||||
struct ship *ship;
|
||||
const char *a;
|
||||
{
|
||||
|
||||
(void) sprintf(sync_bp, "%d %d 1 %s\n",
|
||||
type, ship->file->index, a);
|
||||
while (*sync_bp++)
|
||||
;
|
||||
sync_bp--;
|
||||
if (sync_bp >= &sync_buf[sizeof sync_buf])
|
||||
abort();
|
||||
(void) sync_update(type, ship, a, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
int
|
||||
@@ -241,6 +254,7 @@ Sync()
|
||||
sig_t sighup, sigint;
|
||||
int n;
|
||||
int type, shipnum, isstr;
|
||||
char *astr;
|
||||
long a, b, c, d;
|
||||
char buf[80];
|
||||
char erred = 0;
|
||||
@@ -267,7 +281,7 @@ Sync()
|
||||
}
|
||||
if (n <= 0)
|
||||
return -1;
|
||||
(void) fseek(sync_fp, sync_seek, 0);
|
||||
(void) fseek(sync_fp, sync_seek, SEEK_SET);
|
||||
for (;;) {
|
||||
switch (fscanf(sync_fp, "%d%d%d", &type, &shipnum, &isstr)) {
|
||||
case 3:
|
||||
@@ -299,19 +313,21 @@ Sync()
|
||||
*p = 0;
|
||||
for (p = buf; *p == ' '; p++)
|
||||
;
|
||||
a = (long)p;
|
||||
b = c = d = 0;
|
||||
} else
|
||||
astr = p;
|
||||
a = b = c = d = 0;
|
||||
} else {
|
||||
if (fscanf(sync_fp, "%ld%ld%ld%ld", &a, &b, &c, &d) != 4)
|
||||
goto bad;
|
||||
if (sync_update(type, SHIP(shipnum), a, b, c, d) < 0)
|
||||
astr = NULL;
|
||||
}
|
||||
if (sync_update(type, SHIP(shipnum), astr, a, b, c, d) < 0)
|
||||
goto bad;
|
||||
}
|
||||
bad:
|
||||
erred++;
|
||||
out:
|
||||
if (!erred && sync_bp != sync_buf) {
|
||||
(void) fseek(sync_fp, 0L, 2);
|
||||
(void) fseek(sync_fp, 0L, SEEK_END);
|
||||
(void) fwrite(sync_buf, sizeof *sync_buf, sync_bp - sync_buf,
|
||||
sync_fp);
|
||||
(void) fflush(sync_fp);
|
||||
@@ -331,9 +347,10 @@ out:
|
||||
}
|
||||
|
||||
int
|
||||
sync_update(type, ship, a, b, c, d)
|
||||
sync_update(type, ship, astr, a, b, c, d)
|
||||
int type;
|
||||
struct ship *ship;
|
||||
const char *astr;
|
||||
long a, b, c, d;
|
||||
{
|
||||
switch (type) {
|
||||
@@ -398,9 +415,9 @@ sync_update(type, ship, a, b, c, d)
|
||||
case W_SIGNAL:
|
||||
if (mode == MODE_PLAYER) {
|
||||
if (nobells)
|
||||
Signal("$$: %s", ship, (char *) a);
|
||||
Signal("$$: %s", ship, astr);
|
||||
else
|
||||
Signal("\7$$: %s", ship, (char *) a);
|
||||
Signal("\7$$: %s", ship, astr);
|
||||
}
|
||||
break;
|
||||
case W_CREW: {
|
||||
@@ -411,7 +428,7 @@ sync_update(type, ship, a, b, c, d)
|
||||
break;
|
||||
}
|
||||
case W_CAPTAIN:
|
||||
(void) strncpy(ship->file->captain, (char *)a,
|
||||
(void) strncpy(ship->file->captain, astr,
|
||||
sizeof ship->file->captain - 1);
|
||||
ship->file->captain[sizeof ship->file->captain - 1] = 0;
|
||||
break;
|
||||
@@ -450,7 +467,7 @@ sync_update(type, ship, a, b, c, d)
|
||||
ship->specs->hull = a;
|
||||
break;
|
||||
case W_MOVE:
|
||||
(void) strncpy(ship->file->movebuf, (char *)a,
|
||||
(void) strncpy(ship->file->movebuf, astr,
|
||||
sizeof ship->file->movebuf - 1);
|
||||
ship->file->movebuf[sizeof ship->file->movebuf - 1] = 0;
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user