mirror of
https://github.com/vattam/BSDGames.git
synced 2025-12-21 11:24:49 +00:00
* New upstream version.
* Patch from Malcolm to fix tetris-bsd score formatting if there are more
than 10 scores. (Closes: #50031)
* Include /var/games/bsdgames/sail, (Closes: #50074)
* Fixed robots spelling mistake, (Closes: #50075)
* tetris-bsd now uses its name, (Closes: #50077)
* Fixed phantasia/characs permissions so it's not world-readable
(passwords) (Closes: #50076)
git-svn-id: file:///srv/svn/joey/bsdgames-trunk@5110 a4a2c43b-8ac3-0310-8836-e0e880c912e2
This commit is contained in:
7
debian/changelog
vendored
7
debian/changelog
vendored
@@ -1,6 +1,13 @@
|
|||||||
bsdgames (2.9-1) unstable; urgency=low
|
bsdgames (2.9-1) unstable; urgency=low
|
||||||
|
|
||||||
* New upstream version.
|
* New upstream version.
|
||||||
|
* Patch from Malcolm to fix tetris-bsd score formatting if there are more
|
||||||
|
than 10 scores. (Closes: #50031)
|
||||||
|
* Include /var/games/bsdgames/sail, (Closes: #50074)
|
||||||
|
* Fixed robots spelling mistake, (Closes: #50075)
|
||||||
|
* tetris-bsd now uses its name, (Closes: #50077)
|
||||||
|
* Fixed phantasia/characs permissions so it's not world-readable
|
||||||
|
(passwords) (Closes: #50076)
|
||||||
|
|
||||||
-- Joey Hess <joeyh@master.debian.org> Sat, 13 Nov 1999 14:14:34 -0800
|
-- Joey Hess <joeyh@master.debian.org> Sat, 13 Nov 1999 14:14:34 -0800
|
||||||
|
|
||||||
|
|||||||
10
debian/postinst
vendored
10
debian/postinst
vendored
@@ -33,4 +33,14 @@ touch $SCOREFILES
|
|||||||
chown root.games $SCOREFILES
|
chown root.games $SCOREFILES
|
||||||
chmod 664 $SCOREFILES
|
chmod 664 $SCOREFILES
|
||||||
|
|
||||||
|
# These files may not be world-readable as they have passwords
|
||||||
|
# in them.
|
||||||
|
chmod 660 /var/games/bsdgames/phantasia/characs
|
||||||
|
|
||||||
|
# I have to make this directory here, because older version of this package
|
||||||
|
# always deleted in in their postrm. Oops.
|
||||||
|
mkdir -p /var/games/bsdgames/sail
|
||||||
|
chown root.games /var/games/bsdgames/sail
|
||||||
|
chmod g+rws /var/games/bsdgames/sail
|
||||||
|
|
||||||
#DEBHELPER#
|
#DEBHELPER#
|
||||||
|
|||||||
5
debian/postrm
vendored
5
debian/postrm
vendored
@@ -22,9 +22,8 @@ SCOREFILES="
|
|||||||
# Remove high score files on purge.
|
# Remove high score files on purge.
|
||||||
if [ "$1" = "purge" ]; then
|
if [ "$1" = "purge" ]; then
|
||||||
rm -f $SCOREFILES
|
rm -f $SCOREFILES
|
||||||
|
rmdir /var/games/bsdgames/phantasia /var/games/bsdgames/sail \
|
||||||
|
/var/games/bsdgames /var/games 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rmdir /var/games/bsdgames/phantasia /var/games/bsdgames/sail /var/games/bsdgames \
|
|
||||||
/var/games 2>/dev/null || true
|
|
||||||
|
|
||||||
#DEBHELPER#
|
#DEBHELPER#
|
||||||
|
|||||||
8
debian/preinst
vendored
8
debian/preinst
vendored
@@ -22,14 +22,12 @@ SCOREFILES="
|
|||||||
# move them into the new location.
|
# move them into the new location.
|
||||||
if [ -d /var/lib/games ]; then
|
if [ -d /var/lib/games ]; then
|
||||||
|
|
||||||
# Have to set up directory hierarchy, since this is running as a preinst.
|
# Have to set up directory hierarchy, since this is running as a
|
||||||
mkdir -p /var/games/bsdgames/sail \
|
# preinst.
|
||||||
/var/games/bsdgames/phantasia
|
mkdir -p /var/games/bsdgames/phantasia
|
||||||
chown root.games /var/games/bsdgames \
|
chown root.games /var/games/bsdgames \
|
||||||
/var/games/bsdgames/sail \
|
|
||||||
/var/games/bsdgames/phantasia
|
/var/games/bsdgames/phantasia
|
||||||
chmod g+rws /var/games/bsdgames \
|
chmod g+rws /var/games/bsdgames \
|
||||||
/var/games/bsdgames/sail \
|
|
||||||
/var/games/bsdgames/phantasia
|
/var/games/bsdgames/phantasia
|
||||||
|
|
||||||
for file in $SCOREFILES; do
|
for file in $SCOREFILES; do
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ main(ac, av)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "robots: uknown option: %c\n", *sp);
|
fprintf(stderr, "robots: unknown option: %c\n", *sp);
|
||||||
bad_arg = TRUE;
|
bad_arg = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: scores.c,v 1.4 1997/10/14 01:14:20 lukem Exp $ */
|
/* $NetBSD: scores.c,v 1.8 1999/09/18 19:38:55 jsm Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@@ -45,6 +45,7 @@
|
|||||||
*
|
*
|
||||||
* Major whacks since then.
|
* Major whacks since then.
|
||||||
*/
|
*/
|
||||||
|
#include <err.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <pwd.h>
|
#include <pwd.h>
|
||||||
@@ -99,7 +100,7 @@ getscores(fpp)
|
|||||||
{
|
{
|
||||||
int sd, mint, lck;
|
int sd, mint, lck;
|
||||||
mode_t mask;
|
mode_t mask;
|
||||||
char *mstr, *human;
|
const char *mstr, *human;
|
||||||
FILE *sf;
|
FILE *sf;
|
||||||
|
|
||||||
if (fpp != NULL) {
|
if (fpp != NULL) {
|
||||||
@@ -123,14 +124,10 @@ getscores(fpp)
|
|||||||
setegid(gid);
|
setegid(gid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
(void)fprintf(stderr, "tetris: cannot open %s for %s: %s\n",
|
err(1, "cannot open %s for %s", _PATH_SCOREFILE, human);
|
||||||
_PATH_SCOREFILE, human, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
if ((sf = fdopen(sd, mstr)) == NULL) {
|
if ((sf = fdopen(sd, mstr)) == NULL) {
|
||||||
(void)fprintf(stderr, "tetris: cannot fdopen %s for %s: %s\n",
|
err(1, "cannot fdopen %s for %s", _PATH_SCOREFILE, human);
|
||||||
_PATH_SCOREFILE, human, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
setegid(gid);
|
setegid(gid);
|
||||||
|
|
||||||
@@ -138,15 +135,12 @@ getscores(fpp)
|
|||||||
* Grab a lock.
|
* Grab a lock.
|
||||||
*/
|
*/
|
||||||
if (flock(sd, lck))
|
if (flock(sd, lck))
|
||||||
(void)fprintf(stderr,
|
warn("warning: score file %s cannot be locked",
|
||||||
"tetris: warning: score file %s cannot be locked: %s\n",
|
_PATH_SCOREFILE);
|
||||||
_PATH_SCOREFILE, strerror(errno));
|
|
||||||
|
|
||||||
nscores = fread(scores, sizeof(scores[0]), MAXHISCORES, sf);
|
nscores = fread(scores, sizeof(scores[0]), MAXHISCORES, sf);
|
||||||
if (ferror(sf)) {
|
if (ferror(sf)) {
|
||||||
(void)fprintf(stderr, "tetris: error reading %s: %s\n",
|
err(1, "error reading %s", _PATH_SCOREFILE);
|
||||||
_PATH_SCOREFILE, strerror(errno));
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fpp)
|
if (fpp)
|
||||||
@@ -211,8 +205,7 @@ savescore(level)
|
|||||||
rewind(sf);
|
rewind(sf);
|
||||||
if (fwrite(scores, sizeof(*sp), nscores, sf) != (size_t)nscores ||
|
if (fwrite(scores, sizeof(*sp), nscores, sf) != (size_t)nscores ||
|
||||||
fflush(sf) == EOF)
|
fflush(sf) == EOF)
|
||||||
(void)fprintf(stderr,
|
warnx("error writing %s: %s -- %s",
|
||||||
"tetris: error writing %s: %s -- %s\n",
|
|
||||||
_PATH_SCOREFILE, strerror(errno),
|
_PATH_SCOREFILE, strerror(errno),
|
||||||
"high scores may be damaged");
|
"high scores may be damaged");
|
||||||
}
|
}
|
||||||
@@ -443,10 +436,9 @@ printem(level, offset, hs, n, me)
|
|||||||
(void)putchar('\n');
|
(void)putchar('\n');
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
(void)printf(item + offset < 10 ? " " : " ");
|
|
||||||
sp = &hs[item];
|
sp = &hs[item];
|
||||||
(void)sprintf(buf,
|
(void)sprintf(buf,
|
||||||
"%d%c %6d %-11s (%d on %d)",
|
"%3d%c %6d %-11s (%6d on %d)",
|
||||||
item + offset, sp->hs_time ? '*' : ' ',
|
item + offset, sp->hs_time ? '*' : ' ',
|
||||||
sp->hs_score * sp->hs_level,
|
sp->hs_score * sp->hs_level,
|
||||||
sp->hs_name, sp->hs_score, sp->hs_level);
|
sp->hs_name, sp->hs_score, sp->hs_level);
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
/* $NetBSD: tetris.c,v 1.5 1998/09/13 15:27:30 hubertf Exp $ */
|
/* $NetBSD: tetris.c,v 1.12 1999/09/12 09:02:24 jsm Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1992, 1993
|
* Copyright (c) 1992, 1993
|
||||||
@@ -50,6 +50,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
|
|||||||
|
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
@@ -61,6 +62,21 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
|
|||||||
#include "screen.h"
|
#include "screen.h"
|
||||||
#include "tetris.h"
|
#include "tetris.h"
|
||||||
|
|
||||||
|
cell board[B_SIZE]; /* 1 => occupied, 0 => empty */
|
||||||
|
|
||||||
|
int Rows, Cols; /* current screen size */
|
||||||
|
|
||||||
|
const struct shape *curshape;
|
||||||
|
const struct shape *nextshape;
|
||||||
|
|
||||||
|
long fallrate; /* less than 1 million; smaller => faster */
|
||||||
|
|
||||||
|
int score; /* the obvious thing */
|
||||||
|
gid_t gid, egid;
|
||||||
|
|
||||||
|
char key_msg[100];
|
||||||
|
int showpreview;
|
||||||
|
|
||||||
static void elide __P((void));
|
static void elide __P((void));
|
||||||
static void setup_board __P((void));
|
static void setup_board __P((void));
|
||||||
int main __P((int, char **));
|
int main __P((int, char **));
|
||||||
@@ -80,11 +96,7 @@ setup_board()
|
|||||||
|
|
||||||
p = board;
|
p = board;
|
||||||
for (i = B_SIZE; i; i--)
|
for (i = B_SIZE; i; i--)
|
||||||
#ifndef mips
|
|
||||||
*p++ = i <= (2 * B_COLS) || (i % B_COLS) < 2;
|
*p++ = i <= (2 * B_COLS) || (i % B_COLS) < 2;
|
||||||
#else /* work around compiler bug */
|
|
||||||
*p++ = i <= (2 * B_COLS) || (i % B_COLS) < 2 ? 1 : 0;
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -121,19 +133,24 @@ main(argc, argv)
|
|||||||
char *argv[];
|
char *argv[];
|
||||||
{
|
{
|
||||||
register int pos, c;
|
register int pos, c;
|
||||||
register struct shape *curshape;
|
register const char *keys;
|
||||||
register char *keys;
|
|
||||||
register int level = 2;
|
register int level = 2;
|
||||||
char key_write[6][10];
|
char key_write[6][10];
|
||||||
int ch, i, j;
|
int ch, i, j;
|
||||||
|
int fd;
|
||||||
|
|
||||||
gid = getgid();
|
gid = getgid();
|
||||||
egid = getegid();
|
egid = getegid();
|
||||||
setegid(gid);
|
setegid(gid);
|
||||||
|
|
||||||
|
fd = open("/dev/null", O_RDONLY);
|
||||||
|
if (fd < 3)
|
||||||
|
exit(1);
|
||||||
|
close(fd);
|
||||||
|
|
||||||
keys = "jkl pq";
|
keys = "jkl pq";
|
||||||
|
|
||||||
while ((ch = getopt(argc, argv, "k:l:s")) != -1)
|
while ((ch = getopt(argc, argv, "k:l:ps")) != -1)
|
||||||
switch(ch) {
|
switch(ch) {
|
||||||
case 'k':
|
case 'k':
|
||||||
if (strlen(keys = optarg) != 6)
|
if (strlen(keys = optarg) != 6)
|
||||||
@@ -143,11 +160,14 @@ main(argc, argv)
|
|||||||
level = atoi(optarg);
|
level = atoi(optarg);
|
||||||
if (level < MINLEVEL || level > MAXLEVEL) {
|
if (level < MINLEVEL || level > MAXLEVEL) {
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"tetris: level must be from %d to %d",
|
"tetris-bsd: level must be from %d to %d\n",
|
||||||
MINLEVEL, MAXLEVEL);
|
MINLEVEL, MAXLEVEL);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case 'p':
|
||||||
|
showpreview = 1;
|
||||||
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
showscores(0);
|
showscores(0);
|
||||||
exit(0);
|
exit(0);
|
||||||
@@ -168,7 +188,7 @@ main(argc, argv)
|
|||||||
for (j = i+1; j <= 5; j++) {
|
for (j = i+1; j <= 5; j++) {
|
||||||
if (keys[i] == keys[j]) {
|
if (keys[i] == keys[j]) {
|
||||||
(void)fprintf(stderr,
|
(void)fprintf(stderr,
|
||||||
"%s: Duplicate command keys specified.\n",
|
"%s: duplicate command keys specified.\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
exit (1);
|
exit (1);
|
||||||
}
|
}
|
||||||
@@ -194,6 +214,7 @@ main(argc, argv)
|
|||||||
scr_set();
|
scr_set();
|
||||||
|
|
||||||
pos = A_FIRST*B_COLS + (B_COLS/2)-1;
|
pos = A_FIRST*B_COLS + (B_COLS/2)-1;
|
||||||
|
nextshape = randshape();
|
||||||
curshape = randshape();
|
curshape = randshape();
|
||||||
|
|
||||||
scr_msg(key_msg, 1);
|
scr_msg(key_msg, 1);
|
||||||
@@ -224,7 +245,8 @@ main(argc, argv)
|
|||||||
* Choose a new shape. If it does not fit,
|
* Choose a new shape. If it does not fit,
|
||||||
* the game is over.
|
* the game is over.
|
||||||
*/
|
*/
|
||||||
curshape = randshape();
|
curshape = nextshape;
|
||||||
|
nextshape = randshape();
|
||||||
pos = A_FIRST*B_COLS + (B_COLS/2)-1;
|
pos = A_FIRST*B_COLS + (B_COLS/2)-1;
|
||||||
if (!fits_in(curshape, pos))
|
if (!fits_in(curshape, pos))
|
||||||
break;
|
break;
|
||||||
@@ -262,7 +284,7 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
if (c == keys[1]) {
|
if (c == keys[1]) {
|
||||||
/* turn */
|
/* turn */
|
||||||
struct shape *new = &shapes[curshape->rot];
|
const struct shape *new = &shapes[curshape->rot];
|
||||||
|
|
||||||
if (fits_in(new, pos))
|
if (fits_in(new, pos))
|
||||||
curshape = new;
|
curshape = new;
|
||||||
@@ -282,8 +304,10 @@ main(argc, argv)
|
|||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (c == '\f')
|
if (c == '\f') {
|
||||||
scr_clear();
|
scr_clear();
|
||||||
|
scr_msg(key_msg, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
scr_clear();
|
scr_clear();
|
||||||
@@ -306,7 +330,7 @@ main(argc, argv)
|
|||||||
|
|
||||||
void
|
void
|
||||||
onintr(signo)
|
onintr(signo)
|
||||||
int signo __attribute__((unused));
|
int signo __attribute__((__unused__));
|
||||||
{
|
{
|
||||||
scr_clear();
|
scr_clear();
|
||||||
scr_end();
|
scr_end();
|
||||||
@@ -316,6 +340,6 @@ onintr(signo)
|
|||||||
void
|
void
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
(void)fprintf(stderr, "usage: tetris [-s] [-l level] [-keys]\n");
|
(void)fprintf(stderr, "usage: tetris-bsd [-ps] [-k keys] [-l level]\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user