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
|
* Copyright (c) 1980, 1993
|
||||||
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1993\n\
|
|||||||
#if 0
|
#if 0
|
||||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
|
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 5/31/93";
|
||||||
#else
|
#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
|
||||||
#endif /* not lint */
|
#endif /* not lint */
|
||||||
|
|
||||||
@@ -177,7 +177,7 @@ main(argc, argv)
|
|||||||
if (yorn(0)) {
|
if (yorn(0)) {
|
||||||
|
|
||||||
fixtty(&old); /* restore tty */
|
fixtty(&old); /* restore tty */
|
||||||
execl(TEACH, "teachgammon", args, 0);
|
execl(TEACH, "teachgammon", args[1]?args:0, 0);
|
||||||
|
|
||||||
tflag = 0; /* error! */
|
tflag = 0; /* error! */
|
||||||
writel(noteach);
|
writel(noteach);
|
||||||
@@ -489,6 +489,14 @@ main(argc, argv)
|
|||||||
if (tflag)
|
if (tflag)
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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? */
|
/* backgammon? */
|
||||||
mflag = 0;
|
mflag = 0;
|
||||||
l = bar + 7 * cturn;
|
l = bar + 7 * cturn;
|
||||||
@@ -509,6 +517,8 @@ main(argc, argv)
|
|||||||
gvalue *= 2;
|
gvalue *= 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* report situation */
|
/* report situation */
|
||||||
if (cturn == -1) {
|
if (cturn == -1) {
|
||||||
writel("Red wins ");
|
writel("Red wins ");
|
||||||
|
|||||||
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
|
bsdgames (2.5-4) frozen unstable; urgency=low
|
||||||
|
|
||||||
* Commented out a bogus sprintf prototype in sail/sync.c, makes sail
|
* Commented out a bogus sprintf prototype in sail/sync.c, makes sail
|
||||||
|
|||||||
@@ -513,9 +513,9 @@ list_drivers()
|
|||||||
get_response:
|
get_response:
|
||||||
namelen = DAEMON_SIZE;
|
namelen = DAEMON_SIZE;
|
||||||
errno = 0;
|
errno = 0;
|
||||||
|
for (;;) {
|
||||||
wait.tv_sec = 1;
|
wait.tv_sec = 1;
|
||||||
wait.tv_usec = 0;
|
wait.tv_usec = 0;
|
||||||
for (;;) {
|
|
||||||
if (listc + 1 >= listmax) {
|
if (listc + 1 >= listmax) {
|
||||||
listmax += 20;
|
listmax += 20;
|
||||||
listv = (SOCKET *) realloc((char *) listv,
|
listv = (SOCKET *) realloc((char *) listv,
|
||||||
|
|||||||
@@ -59,10 +59,10 @@ main(ac, av)
|
|||||||
int ac;
|
int ac;
|
||||||
char **av;
|
char **av;
|
||||||
{
|
{
|
||||||
char *sp;
|
const char *sp;
|
||||||
bool bad_arg;
|
bool bad_arg;
|
||||||
bool show_only;
|
bool show_only;
|
||||||
extern char *Scorefile;
|
extern const char *Scorefile;
|
||||||
extern int Max_per_uid;
|
extern int Max_per_uid;
|
||||||
int score_wfd; /* high score writable file descriptor */
|
int score_wfd; /* high score writable file descriptor */
|
||||||
int score_err = 0; /* hold errno from score file open */
|
int score_err = 0; /* hold errno from score file open */
|
||||||
@@ -70,6 +70,8 @@ main(ac, av)
|
|||||||
score_wfd = open(Scorefile, O_RDWR);
|
score_wfd = open(Scorefile, O_RDWR);
|
||||||
if (score_wfd < 0)
|
if (score_wfd < 0)
|
||||||
score_err = errno;
|
score_err = errno;
|
||||||
|
else if (score_wfd < 3)
|
||||||
|
exit(1);
|
||||||
|
|
||||||
/* Revoke setgid privileges */
|
/* Revoke setgid privileges */
|
||||||
setregid(getgid(), getgid());
|
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
|
#define BUFSIZE 4096
|
||||||
|
|
||||||
|
static const char SF[] = _PATH_SYNC;
|
||||||
|
static const char LF[] = _PATH_LOCK;
|
||||||
static char sync_buf[BUFSIZE];
|
static char sync_buf[BUFSIZE];
|
||||||
static char *sync_bp = sync_buf;
|
static char *sync_bp = sync_buf;
|
||||||
static char sync_lock[25];
|
static char sync_lock[sizeof SF];
|
||||||
static char sync_file[25];
|
static char sync_file[sizeof LF];
|
||||||
static long sync_seek;
|
static long sync_seek;
|
||||||
static FILE *sync_fp;
|
static FILE *sync_fp;
|
||||||
|
|
||||||
@@ -122,7 +124,7 @@ makesignal(va_alias)
|
|||||||
fmtship(format, sizeof(format), fmt, ship);
|
fmtship(format, sizeof(format), fmt, ship);
|
||||||
(void) vsprintf(message, format, ap);
|
(void) vsprintf(message, format, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
Write(W_SIGNAL, from, 1, (long)message, 0, 0, 0);
|
Writestr(W_SIGNAL, from, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -147,7 +149,7 @@ makemsg(va_alias)
|
|||||||
#endif
|
#endif
|
||||||
(void) vsprintf(message, fmt, ap);
|
(void) vsprintf(message, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
Write(W_SIGNAL, from, 1, (long)message, 0, 0, 0);
|
Writestr(W_SIGNAL, from, message);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
@@ -158,9 +160,8 @@ sync_exists(game)
|
|||||||
struct stat s;
|
struct stat s;
|
||||||
time_t t;
|
time_t t;
|
||||||
|
|
||||||
/* (void) sprintf(buf, _PATH_SYNC, game);*/
|
(void) sprintf(buf, SF, game);
|
||||||
(void) time(&t);
|
(void) time(&t);
|
||||||
|
|
||||||
setegid(egid);
|
setegid(egid);
|
||||||
if (stat(buf, &s) < 0) {
|
if (stat(buf, &s) < 0) {
|
||||||
setegid(gid);
|
setegid(gid);
|
||||||
@@ -168,7 +169,7 @@ sync_exists(game)
|
|||||||
}
|
}
|
||||||
if (s.st_mtime < t - 60*60*2) { /* 2 hours */
|
if (s.st_mtime < t - 60*60*2) { /* 2 hours */
|
||||||
(void) unlink(buf);
|
(void) unlink(buf);
|
||||||
(void) sprintf(buf, _PATH_LOCK, game);
|
(void) sprintf(buf, LF, game);
|
||||||
(void) unlink(buf);
|
(void) unlink(buf);
|
||||||
setegid(gid);
|
setegid(gid);
|
||||||
return 0;
|
return 0;
|
||||||
@@ -184,8 +185,8 @@ sync_open()
|
|||||||
struct stat tmp;
|
struct stat tmp;
|
||||||
if (sync_fp != NULL)
|
if (sync_fp != NULL)
|
||||||
(void) fclose(sync_fp);
|
(void) fclose(sync_fp);
|
||||||
(void) sprintf(sync_lock, _PATH_LOCK, game);
|
(void) sprintf(sync_lock, LF, game);
|
||||||
(void) sprintf(sync_file, _PATH_SYNC, game);
|
(void) sprintf(sync_file, SF, game);
|
||||||
setegid(egid);
|
setegid(egid);
|
||||||
if (stat(sync_file, &tmp) < 0) {
|
if (stat(sync_file, &tmp) < 0) {
|
||||||
mode_t omask = umask(002);
|
mode_t omask = umask(002);
|
||||||
@@ -214,25 +215,37 @@ sync_close(remove)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
Write(type, ship, isstr, a, b, c, d)
|
Write(type, ship, a, b, c, d)
|
||||||
int type;
|
int type;
|
||||||
struct ship *ship;
|
struct ship *ship;
|
||||||
int isstr;
|
|
||||||
long a, b, c, d;
|
long a, b, c, d;
|
||||||
{
|
{
|
||||||
|
|
||||||
if (isstr)
|
(void) sprintf(sync_bp, "%d %d 0 %ld %ld %ld %ld\n",
|
||||||
(void) sprintf(sync_bp, "%d %d %d %s\n",
|
type, ship->file->index, a, b, c, d);
|
||||||
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);
|
|
||||||
while (*sync_bp++)
|
while (*sync_bp++)
|
||||||
;
|
;
|
||||||
sync_bp--;
|
sync_bp--;
|
||||||
if (sync_bp >= &sync_buf[sizeof sync_buf])
|
if (sync_bp >= &sync_buf[sizeof sync_buf])
|
||||||
abort();
|
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
|
int
|
||||||
@@ -241,6 +254,7 @@ Sync()
|
|||||||
sig_t sighup, sigint;
|
sig_t sighup, sigint;
|
||||||
int n;
|
int n;
|
||||||
int type, shipnum, isstr;
|
int type, shipnum, isstr;
|
||||||
|
char *astr;
|
||||||
long a, b, c, d;
|
long a, b, c, d;
|
||||||
char buf[80];
|
char buf[80];
|
||||||
char erred = 0;
|
char erred = 0;
|
||||||
@@ -267,7 +281,7 @@ Sync()
|
|||||||
}
|
}
|
||||||
if (n <= 0)
|
if (n <= 0)
|
||||||
return -1;
|
return -1;
|
||||||
(void) fseek(sync_fp, sync_seek, 0);
|
(void) fseek(sync_fp, sync_seek, SEEK_SET);
|
||||||
for (;;) {
|
for (;;) {
|
||||||
switch (fscanf(sync_fp, "%d%d%d", &type, &shipnum, &isstr)) {
|
switch (fscanf(sync_fp, "%d%d%d", &type, &shipnum, &isstr)) {
|
||||||
case 3:
|
case 3:
|
||||||
@@ -299,19 +313,21 @@ Sync()
|
|||||||
*p = 0;
|
*p = 0;
|
||||||
for (p = buf; *p == ' '; p++)
|
for (p = buf; *p == ' '; p++)
|
||||||
;
|
;
|
||||||
a = (long)p;
|
astr = p;
|
||||||
b = c = d = 0;
|
a = b = c = d = 0;
|
||||||
} else
|
} else {
|
||||||
if (fscanf(sync_fp, "%ld%ld%ld%ld", &a, &b, &c, &d) != 4)
|
if (fscanf(sync_fp, "%ld%ld%ld%ld", &a, &b, &c, &d) != 4)
|
||||||
goto bad;
|
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;
|
goto bad;
|
||||||
}
|
}
|
||||||
bad:
|
bad:
|
||||||
erred++;
|
erred++;
|
||||||
out:
|
out:
|
||||||
if (!erred && sync_bp != sync_buf) {
|
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,
|
(void) fwrite(sync_buf, sizeof *sync_buf, sync_bp - sync_buf,
|
||||||
sync_fp);
|
sync_fp);
|
||||||
(void) fflush(sync_fp);
|
(void) fflush(sync_fp);
|
||||||
@@ -331,9 +347,10 @@ out:
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
sync_update(type, ship, a, b, c, d)
|
sync_update(type, ship, astr, a, b, c, d)
|
||||||
int type;
|
int type;
|
||||||
struct ship *ship;
|
struct ship *ship;
|
||||||
|
const char *astr;
|
||||||
long a, b, c, d;
|
long a, b, c, d;
|
||||||
{
|
{
|
||||||
switch (type) {
|
switch (type) {
|
||||||
@@ -398,9 +415,9 @@ sync_update(type, ship, a, b, c, d)
|
|||||||
case W_SIGNAL:
|
case W_SIGNAL:
|
||||||
if (mode == MODE_PLAYER) {
|
if (mode == MODE_PLAYER) {
|
||||||
if (nobells)
|
if (nobells)
|
||||||
Signal("$$: %s", ship, (char *) a);
|
Signal("$$: %s", ship, astr);
|
||||||
else
|
else
|
||||||
Signal("\7$$: %s", ship, (char *) a);
|
Signal("\7$$: %s", ship, astr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case W_CREW: {
|
case W_CREW: {
|
||||||
@@ -411,7 +428,7 @@ sync_update(type, ship, a, b, c, d)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case W_CAPTAIN:
|
case W_CAPTAIN:
|
||||||
(void) strncpy(ship->file->captain, (char *)a,
|
(void) strncpy(ship->file->captain, astr,
|
||||||
sizeof ship->file->captain - 1);
|
sizeof ship->file->captain - 1);
|
||||||
ship->file->captain[sizeof ship->file->captain - 1] = 0;
|
ship->file->captain[sizeof ship->file->captain - 1] = 0;
|
||||||
break;
|
break;
|
||||||
@@ -450,7 +467,7 @@ sync_update(type, ship, a, b, c, d)
|
|||||||
ship->specs->hull = a;
|
ship->specs->hull = a;
|
||||||
break;
|
break;
|
||||||
case W_MOVE:
|
case W_MOVE:
|
||||||
(void) strncpy(ship->file->movebuf, (char *)a,
|
(void) strncpy(ship->file->movebuf, astr,
|
||||||
sizeof ship->file->movebuf - 1);
|
sizeof ship->file->movebuf - 1);
|
||||||
ship->file->movebuf[sizeof ship->file->movebuf - 1] = 0;
|
ship->file->movebuf[sizeof ship->file->movebuf - 1] = 0;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user