mirror of
https://git.FreeBSD.org/ports.git
synced 2024-11-26 00:55:14 +00:00
Bunch 'o fixes for the BSD games, many from NetBSD.
Submitted by: "Stephen J. Roznowski" <sjr@comcast.net> PR: 12727
This commit is contained in:
parent
756e0a21ba
commit
49f7724c25
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=93725
@ -6,8 +6,7 @@
|
||||
#
|
||||
|
||||
PORTNAME= freebsd-games
|
||||
PORTVERSION= 5.0
|
||||
PORTREVISION= 1
|
||||
PORTVERSION= 5.1
|
||||
CATEGORIES= games
|
||||
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
||||
MASTER_SITE_SUBDIR=markm
|
||||
@ -51,12 +50,10 @@ MANCOMPRESSED= maybe
|
||||
IGNOREFILES= freebsd-games-5.0.tar.bz2
|
||||
|
||||
post-extract:
|
||||
@${CP} ${FILESDIR}/Makefile ${BUILD_WRKSRC}
|
||||
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} \
|
||||
${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} extract)
|
||||
|
||||
post-patch:
|
||||
@${CP} ${FILESDIR}/misc.h ${WRKSRC}/sail
|
||||
@${FIND} ${WRKSRC} -name '*.c' -or -name '*.h' -or -name '*.6' -or \
|
||||
-name 'index' | ${XARGS} ${REINPLACE_CMD} -e \
|
||||
's|share/games|local/share/games|g' \
|
||||
|
@ -1 +1 @@
|
||||
MD5 (freebsd-games-5.0.tar.bz2) = IGNORE
|
||||
MD5 (freebsd-games-5.1.tar.bz2) = IGNORE
|
||||
|
@ -1,37 +0,0 @@
|
||||
# $FreeBSD$
|
||||
.include "Makefile.inc"
|
||||
|
||||
GAMES= adventure arithmetic atc backgammon battlestar bs canfield cribbage \
|
||||
fish hack hangman larn mille phantasia piano pig quiz robots rogue \
|
||||
sail snake trek worm wump
|
||||
all: ${GAMES}
|
||||
.for I in ${GAMES}
|
||||
cd ${I} && make depend && make all
|
||||
.endfor
|
||||
|
||||
install: ${GAMES}
|
||||
mtree -deU -f var.mtree -p ${VARDIR}
|
||||
mtree -deU -f share.mtree -p ${SHAREDIR}
|
||||
.for I in ${GAMES}
|
||||
cd ${I} && make install
|
||||
.endfor
|
||||
|
||||
clean: ${GAMES}
|
||||
.for I in ${GAMES}
|
||||
cd ${I} && make clean
|
||||
.endfor
|
||||
|
||||
extract: ${GAMES}
|
||||
|
||||
.for I in ${GAMES}
|
||||
${I}:
|
||||
cvs -d `pwd`/cvs get ${I}
|
||||
.endfor
|
||||
|
||||
commit:
|
||||
.for I in ${GAMES}
|
||||
cvs -d `pwd`/cvs commit -F ./commitmsg ${I}
|
||||
.endfor
|
||||
|
||||
distclean:
|
||||
rm -rf ${GAMES}
|
@ -1,2 +0,0 @@
|
||||
log(struct ship *s);
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- adventure/adventure.6.orig Sun Sep 7 23:21:31 2003
|
||||
+++ adventure/adventure.6 Sun Sep 7 23:21:50 2003
|
||||
@@ -56,3 +56,8 @@
|
||||
.Dq quit ;
|
||||
to save a game for later resumption, enter
|
||||
.Dq suspend .
|
||||
+.Sh AUTHORS
|
||||
+The game
|
||||
+.Nm
|
||||
+was originally written in Fortran by Will Crowther and Don Woods.
|
||||
+It was later translated to C and enhanced by Jim Gillogly (jim@rand.org).
|
@ -1,11 +0,0 @@
|
||||
--- larn/Makefile.orig Sat Jul 26 00:06:00 2003
|
||||
+++ larn/Makefile Sat Jul 26 00:06:22 2003
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
PROG= larn
|
||||
MAN= larn.6
|
||||
-CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -fwritable-strings
|
||||
+CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -fwritable-strings -DNOVARARGS
|
||||
SRCS= main.c object.c create.c tok.c display.c global.c data.c io.c \
|
||||
monster.c store.c diag.c help.c config.c nap.c bill.c scores.c \
|
||||
signal.c moreobj.c movem.c regen.c fortune.c savelev.c
|
@ -1,26 +0,0 @@
|
||||
Index: phantasia/io.c
|
||||
===================================================================
|
||||
RCS file: /var/fcvs/src/games/phantasia/Attic/io.c,v
|
||||
retrieving revision 1.6
|
||||
diff -u -r1.6 io.c
|
||||
--- phantasia/io.c 16 Nov 1999 02:57:33 -0000 1.6
|
||||
+++ phantasia/io.c 10 Sep 2003 09:52:52 -0000
|
||||
@@ -79,6 +79,9 @@
|
||||
case CH_NEWLINE: /* terminate string */
|
||||
break;
|
||||
|
||||
+ case CH_CR: /* terminate string */
|
||||
+ break;
|
||||
+
|
||||
case CH_REDRAW: /* redraw screen */
|
||||
clearok(stdscr, TRUE);
|
||||
continue;
|
||||
@@ -91,7 +94,7 @@
|
||||
|
||||
*inptr = '\0'; /* terminate string */
|
||||
}
|
||||
- while (ch != CH_NEWLINE && inptr < cp + mx);
|
||||
+ while (ch != CH_NEWLINE && ch != CH_CR && inptr < cp + mx);
|
||||
}
|
||||
/**/
|
||||
/************************************************************************
|
@ -1,13 +0,0 @@
|
||||
Index: phantasia/phantdefs.h
|
||||
===================================================================
|
||||
RCS file: /var/fcvs/src/games/phantasia/Attic/phantdefs.h,v
|
||||
retrieving revision 1.1.1.1
|
||||
diff -u -r1.1.1.1 phantdefs.h
|
||||
--- phantasia/phantdefs.h 4 Sep 1994 04:03:06 -0000 1.1.1.1
|
||||
+++ phantasia/phantdefs.h 10 Sep 2003 09:53:25 -0000
|
||||
@@ -136,4 +136,5 @@
|
||||
#define CH_KILL '\030' /* kill character (ctrl-X) */
|
||||
#define CH_ERASE '\010' /* erase character (ctrl-H) */
|
||||
#define CH_NEWLINE '\n' /* newline */
|
||||
+#define CH_CR '\r' /* carriage return */
|
||||
#define CH_REDRAW '\014' /* redraw screen character (ctrl-L) */
|
@ -1,23 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/inventory.c 30 Nov 1999 03:49:23 -0000 1.4
|
||||
+++ rogue/inventory.c 21 Aug 2003 19:58:45 -0000
|
||||
@@ -415,14 +415,14 @@
|
||||
mix_colors()
|
||||
{
|
||||
short i, j, k;
|
||||
- char *t;
|
||||
+ char t[MAX_ID_TITLE_LEN];
|
||||
|
||||
for (i = 0; i <= 32; i++) {
|
||||
j = get_rand(0, (POTIONS - 1));
|
||||
k = get_rand(0, (POTIONS - 1));
|
||||
- t = id_potions[j].title;
|
||||
- id_potions[j].title = id_potions[k].title;
|
||||
- id_potions[k].title = t;
|
||||
+ memcpy(t, id_potions[j].title, MAX_ID_TITLE_LEN);
|
||||
+ memcpy(id_potions[j].title, id_potions[k].title, MAX_ID_TITLE_LEN);
|
||||
+ memcpy(id_potions[k].title, t, MAX_ID_TITLE_LEN);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/message.c 20 Jul 2000 10:35:07 -0000 1.7.2.1
|
||||
+++ rogue/message.c 21 Aug 2003 19:58:51 -0000
|
||||
@@ -60,7 +60,7 @@
|
||||
char msgs[NMESSAGES][DCOLS] = {"", "", "", "", ""};
|
||||
short msg_col = 0, imsg = -1;
|
||||
boolean msg_cleared = 1, rmsg = 0;
|
||||
-char hunger_str[8] = "";
|
||||
+char hunger_str[HUNGER_STR_LEN] = "";
|
||||
const char *more = "-more-";
|
||||
|
||||
extern boolean cant_int, did_int, interrupted, save_is_interactive, flush;
|
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/move.c 30 Nov 1999 03:49:24 -0000 1.7
|
||||
+++ rogue/move.c 21 Aug 2003 20:02:38 -0000
|
||||
@@ -64,7 +64,6 @@
|
||||
extern short cur_level, max_level;
|
||||
extern short bear_trap, haste_self, confused;
|
||||
extern short e_rings, regeneration, auto_search;
|
||||
-extern char hunger_str[];
|
||||
extern boolean being_held, interrupted, r_teleport, passgo;
|
||||
|
||||
one_move_rogue(dirch, pickup)
|
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/object.c 30 Nov 1999 03:49:25 -0000 1.5
|
||||
+++ rogue/object.c 21 Aug 2003 20:04:13 -0000
|
||||
@@ -159,7 +159,6 @@
|
||||
|
||||
extern short cur_level, max_level;
|
||||
extern short party_room;
|
||||
-extern char *error_file;
|
||||
extern boolean is_wood[];
|
||||
|
||||
put_objects()
|
@ -1,13 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/pack.c 30 Nov 1999 03:49:25 -0000 1.8
|
||||
+++ rogue/pack.c 21 Aug 2003 20:07:28 -0000
|
||||
@@ -342,7 +342,7 @@
|
||||
char desc[DCOLS];
|
||||
|
||||
if (rogue.armor) {
|
||||
- message("your already wearing some", 0);
|
||||
+ message("you're already wearing some", 0);
|
||||
return;
|
||||
}
|
||||
ch = pack_letter("wear what?", ARMOR);
|
@ -1,28 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/rogue.h 17 Dec 2001 12:43:23 -0000 1.3.2.1
|
||||
+++ rogue/rogue.h 21 Aug 2003 20:04:36 -0000
|
||||
@@ -194,9 +194,12 @@
|
||||
|
||||
#define MAX_OPT_LEN 40
|
||||
|
||||
+#define HUNGER_STR_LEN 8
|
||||
+
|
||||
+#define MAX_ID_TITLE_LEN 64
|
||||
struct id {
|
||||
short value;
|
||||
- char *title;
|
||||
+ char title[MAX_ID_TITLE_LEN];
|
||||
char *real;
|
||||
unsigned short id_status;
|
||||
};
|
||||
@@ -472,3 +475,9 @@
|
||||
short second; /* 0 - 59 */
|
||||
};
|
||||
|
||||
+/*
|
||||
+ * external routine declarations.
|
||||
+ */
|
||||
+extern char hunger_str[HUNGER_STR_LEN];
|
||||
+extern char login_name[MAX_OPT_LEN];
|
||||
+extern const char *error_file;
|
@ -1,82 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/save.c 30 Nov 1999 03:49:27 -0000 1.6
|
||||
+++ rogue/save.c 21 Aug 2003 20:03:37 -0000
|
||||
@@ -63,8 +63,6 @@
|
||||
|
||||
extern boolean detect_monster;
|
||||
extern short cur_level, max_level;
|
||||
-extern char hunger_str[];
|
||||
-extern char login_name[];
|
||||
extern short party_room;
|
||||
extern short foods;
|
||||
extern boolean is_wood[];
|
||||
@@ -102,15 +100,23 @@
|
||||
{
|
||||
FILE *fp;
|
||||
int file_id;
|
||||
- char name_buffer[80];
|
||||
+ char *name_buffer;
|
||||
+ size_t len;
|
||||
char *hptr;
|
||||
struct rogue_time rt_buf;
|
||||
|
||||
if (sfile[0] == '~') {
|
||||
if (hptr = md_getenv("HOME")) {
|
||||
- (void) strcpy(name_buffer, hptr);
|
||||
- (void) strcat(name_buffer, sfile+1);
|
||||
- sfile = name_buffer;
|
||||
+ len = strlen(hptr) + strlen(sfile);
|
||||
+ name_buffer = md_malloc(len);
|
||||
+ if (name_buffer == NULL) {
|
||||
+ message("out of memory for save file name", 0);
|
||||
+ sfile = error_file;
|
||||
+ } else {
|
||||
+ (void) strcpy(name_buffer, hptr);
|
||||
+ (void) strcat(name_buffer, sfile+1);
|
||||
+ sfile = name_buffer;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
/* revoke */
|
||||
@@ -199,10 +205,10 @@
|
||||
r_read(fp, (char *) &detect_monster, sizeof(detect_monster));
|
||||
r_read(fp, (char *) &cur_level, sizeof(cur_level));
|
||||
r_read(fp, (char *) &max_level, sizeof(max_level));
|
||||
- read_string(hunger_str, fp);
|
||||
+ read_string(hunger_str, fp, sizeof hunger_str);
|
||||
|
||||
- (void) strcpy(tbuf, login_name);
|
||||
- read_string(login_name, fp);
|
||||
+ (void) strlcpy(tbuf, login_name, sizeof tbuf);
|
||||
+ read_string(login_name, fp, sizeof login_name);
|
||||
if (strcmp(tbuf, login_name)) {
|
||||
clean_up("you're not the original player");
|
||||
}
|
||||
@@ -345,7 +351,7 @@
|
||||
r_read(fp, (char *) &(id_table[i].value), sizeof(short));
|
||||
r_read(fp, (char *) &(id_table[i].id_status),
|
||||
sizeof(unsigned short));
|
||||
- read_string(id_table[i].title, fp);
|
||||
+ read_string(id_table[i].title, fp, MAX_ID_TITLE_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -362,13 +368,16 @@
|
||||
r_write(fp, s, n);
|
||||
}
|
||||
|
||||
-read_string(s, fp)
|
||||
+read_string(s, fp, len)
|
||||
char *s;
|
||||
FILE *fp;
|
||||
+size_t len;
|
||||
{
|
||||
short n;
|
||||
|
||||
r_read(fp, (char *) &n, sizeof(short));
|
||||
+ if (n > len)
|
||||
+ clean_up("read_string: corrupt game file");
|
||||
r_read(fp, s, n);
|
||||
xxxx(s, n);
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/score.c 30 Nov 1999 03:49:27 -0000 1.4
|
||||
+++ rogue/score.c 21 Aug 2003 20:03:30 -0000
|
||||
@@ -58,7 +58,6 @@
|
||||
#include "rogue.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
-extern char login_name[];
|
||||
extern char *m_names[];
|
||||
extern short max_level;
|
||||
extern boolean score_only, no_skull, msg_cleared;
|
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/use.c 30 Nov 1999 03:49:29 -0000 1.4
|
||||
+++ rogue/use.c 21 Aug 2003 20:06:00 -0000
|
||||
@@ -68,7 +68,6 @@
|
||||
const char *strange_feeling = "you have a strange feeling for a moment, then it passes";
|
||||
|
||||
extern short bear_trap;
|
||||
-extern char hunger_str[];
|
||||
extern short cur_room;
|
||||
extern long level_points[];
|
||||
extern boolean being_held;
|
@ -1,10 +0,0 @@
|
||||
--- sail/dr_1.c.orig Sat Jul 26 00:11:20 2003
|
||||
+++ sail/dr_1.c Sat Jul 26 00:11:33 2003
|
||||
@@ -40,6 +40,7 @@
|
||||
#endif /* not lint */
|
||||
|
||||
#include "driver.h"
|
||||
+#include "misc.h"
|
||||
|
||||
unfoul()
|
||||
{
|
@ -1,10 +0,0 @@
|
||||
--- sail/misc.c.orig Sat Jul 26 00:09:23 2003
|
||||
+++ sail/misc.c Sat Jul 26 00:09:38 2003
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include "externs.h"
|
||||
#include "pathnames.h"
|
||||
+#include "misc.h"
|
||||
|
||||
#define distance(x,y) (abs(x) >= abs(y) ? abs(x) + abs(y)/2 : abs(y) + abs(x)/2)
|
||||
|
@ -1,10 +0,0 @@
|
||||
--- sail/pl_1.c.orig Sat Jul 26 00:10:30 2003
|
||||
+++ sail/pl_1.c Sat Jul 26 00:10:42 2003
|
||||
@@ -40,6 +40,7 @@
|
||||
#endif /* not lint */
|
||||
|
||||
#include "player.h"
|
||||
+#include "misc.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
@ -1,28 +0,0 @@
|
||||
--- trek/utility.c.orig Sat Jul 26 00:02:02 2003
|
||||
+++ trek/utility.c Sat Jul 26 00:14:18 2003
|
||||
@@ -43,7 +43,7 @@
|
||||
** ASSORTED UTILITY ROUTINES
|
||||
*/
|
||||
#include <stdio.h>
|
||||
-#include <varargs.h>
|
||||
+#include <stdarg.h>
|
||||
|
||||
/*
|
||||
** BLOCK MOVE
|
||||
@@ -143,14 +143,12 @@
|
||||
** SYSTEM ERROR
|
||||
*/
|
||||
|
||||
-syserr(fmt, va_alist)
|
||||
-const char *fmt;
|
||||
-va_dcl
|
||||
+syserr(char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
extern int errno;
|
||||
|
||||
- va_start(ap);
|
||||
+ va_start(ap,fmt);
|
||||
printf("\n\07TREK SYSERR: ");
|
||||
vfprintf(stdout, fmt, ap);
|
||||
printf("\n");
|
@ -6,8 +6,7 @@
|
||||
#
|
||||
|
||||
PORTNAME= freebsd-games
|
||||
PORTVERSION= 5.0
|
||||
PORTREVISION= 1
|
||||
PORTVERSION= 5.1
|
||||
CATEGORIES= games
|
||||
MASTER_SITES= ${MASTER_SITE_LOCAL}
|
||||
MASTER_SITE_SUBDIR=markm
|
||||
@ -51,12 +50,10 @@ MANCOMPRESSED= maybe
|
||||
IGNOREFILES= freebsd-games-5.0.tar.bz2
|
||||
|
||||
post-extract:
|
||||
@${CP} ${FILESDIR}/Makefile ${BUILD_WRKSRC}
|
||||
@(cd ${BUILD_WRKSRC}; ${SETENV} ${MAKE_ENV} \
|
||||
${MAKE} ${MAKE_FLAGS} ${MAKEFILE} ${MAKE_ARGS} extract)
|
||||
|
||||
post-patch:
|
||||
@${CP} ${FILESDIR}/misc.h ${WRKSRC}/sail
|
||||
@${FIND} ${WRKSRC} -name '*.c' -or -name '*.h' -or -name '*.6' -or \
|
||||
-name 'index' | ${XARGS} ${REINPLACE_CMD} -e \
|
||||
's|share/games|local/share/games|g' \
|
||||
|
@ -1 +1 @@
|
||||
MD5 (freebsd-games-5.0.tar.bz2) = IGNORE
|
||||
MD5 (freebsd-games-5.1.tar.bz2) = IGNORE
|
||||
|
@ -1,37 +0,0 @@
|
||||
# $FreeBSD$
|
||||
.include "Makefile.inc"
|
||||
|
||||
GAMES= adventure arithmetic atc backgammon battlestar bs canfield cribbage \
|
||||
fish hack hangman larn mille phantasia piano pig quiz robots rogue \
|
||||
sail snake trek worm wump
|
||||
all: ${GAMES}
|
||||
.for I in ${GAMES}
|
||||
cd ${I} && make depend && make all
|
||||
.endfor
|
||||
|
||||
install: ${GAMES}
|
||||
mtree -deU -f var.mtree -p ${VARDIR}
|
||||
mtree -deU -f share.mtree -p ${SHAREDIR}
|
||||
.for I in ${GAMES}
|
||||
cd ${I} && make install
|
||||
.endfor
|
||||
|
||||
clean: ${GAMES}
|
||||
.for I in ${GAMES}
|
||||
cd ${I} && make clean
|
||||
.endfor
|
||||
|
||||
extract: ${GAMES}
|
||||
|
||||
.for I in ${GAMES}
|
||||
${I}:
|
||||
cvs -d `pwd`/cvs get ${I}
|
||||
.endfor
|
||||
|
||||
commit:
|
||||
.for I in ${GAMES}
|
||||
cvs -d `pwd`/cvs commit -F ./commitmsg ${I}
|
||||
.endfor
|
||||
|
||||
distclean:
|
||||
rm -rf ${GAMES}
|
@ -1,2 +0,0 @@
|
||||
log(struct ship *s);
|
||||
|
@ -1,11 +0,0 @@
|
||||
--- adventure/adventure.6.orig Sun Sep 7 23:21:31 2003
|
||||
+++ adventure/adventure.6 Sun Sep 7 23:21:50 2003
|
||||
@@ -56,3 +56,8 @@
|
||||
.Dq quit ;
|
||||
to save a game for later resumption, enter
|
||||
.Dq suspend .
|
||||
+.Sh AUTHORS
|
||||
+The game
|
||||
+.Nm
|
||||
+was originally written in Fortran by Will Crowther and Don Woods.
|
||||
+It was later translated to C and enhanced by Jim Gillogly (jim@rand.org).
|
@ -1,11 +0,0 @@
|
||||
--- larn/Makefile.orig Sat Jul 26 00:06:00 2003
|
||||
+++ larn/Makefile Sat Jul 26 00:06:22 2003
|
||||
@@ -54,7 +54,7 @@
|
||||
|
||||
PROG= larn
|
||||
MAN= larn.6
|
||||
-CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -fwritable-strings
|
||||
+CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -fwritable-strings -DNOVARARGS
|
||||
SRCS= main.c object.c create.c tok.c display.c global.c data.c io.c \
|
||||
monster.c store.c diag.c help.c config.c nap.c bill.c scores.c \
|
||||
signal.c moreobj.c movem.c regen.c fortune.c savelev.c
|
@ -1,26 +0,0 @@
|
||||
Index: phantasia/io.c
|
||||
===================================================================
|
||||
RCS file: /var/fcvs/src/games/phantasia/Attic/io.c,v
|
||||
retrieving revision 1.6
|
||||
diff -u -r1.6 io.c
|
||||
--- phantasia/io.c 16 Nov 1999 02:57:33 -0000 1.6
|
||||
+++ phantasia/io.c 10 Sep 2003 09:52:52 -0000
|
||||
@@ -79,6 +79,9 @@
|
||||
case CH_NEWLINE: /* terminate string */
|
||||
break;
|
||||
|
||||
+ case CH_CR: /* terminate string */
|
||||
+ break;
|
||||
+
|
||||
case CH_REDRAW: /* redraw screen */
|
||||
clearok(stdscr, TRUE);
|
||||
continue;
|
||||
@@ -91,7 +94,7 @@
|
||||
|
||||
*inptr = '\0'; /* terminate string */
|
||||
}
|
||||
- while (ch != CH_NEWLINE && inptr < cp + mx);
|
||||
+ while (ch != CH_NEWLINE && ch != CH_CR && inptr < cp + mx);
|
||||
}
|
||||
/**/
|
||||
/************************************************************************
|
@ -1,13 +0,0 @@
|
||||
Index: phantasia/phantdefs.h
|
||||
===================================================================
|
||||
RCS file: /var/fcvs/src/games/phantasia/Attic/phantdefs.h,v
|
||||
retrieving revision 1.1.1.1
|
||||
diff -u -r1.1.1.1 phantdefs.h
|
||||
--- phantasia/phantdefs.h 4 Sep 1994 04:03:06 -0000 1.1.1.1
|
||||
+++ phantasia/phantdefs.h 10 Sep 2003 09:53:25 -0000
|
||||
@@ -136,4 +136,5 @@
|
||||
#define CH_KILL '\030' /* kill character (ctrl-X) */
|
||||
#define CH_ERASE '\010' /* erase character (ctrl-H) */
|
||||
#define CH_NEWLINE '\n' /* newline */
|
||||
+#define CH_CR '\r' /* carriage return */
|
||||
#define CH_REDRAW '\014' /* redraw screen character (ctrl-L) */
|
@ -1,23 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/inventory.c 30 Nov 1999 03:49:23 -0000 1.4
|
||||
+++ rogue/inventory.c 21 Aug 2003 19:58:45 -0000
|
||||
@@ -415,14 +415,14 @@
|
||||
mix_colors()
|
||||
{
|
||||
short i, j, k;
|
||||
- char *t;
|
||||
+ char t[MAX_ID_TITLE_LEN];
|
||||
|
||||
for (i = 0; i <= 32; i++) {
|
||||
j = get_rand(0, (POTIONS - 1));
|
||||
k = get_rand(0, (POTIONS - 1));
|
||||
- t = id_potions[j].title;
|
||||
- id_potions[j].title = id_potions[k].title;
|
||||
- id_potions[k].title = t;
|
||||
+ memcpy(t, id_potions[j].title, MAX_ID_TITLE_LEN);
|
||||
+ memcpy(id_potions[j].title, id_potions[k].title, MAX_ID_TITLE_LEN);
|
||||
+ memcpy(id_potions[k].title, t, MAX_ID_TITLE_LEN);
|
||||
}
|
||||
}
|
||||
|
@ -1,13 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/message.c 20 Jul 2000 10:35:07 -0000 1.7.2.1
|
||||
+++ rogue/message.c 21 Aug 2003 19:58:51 -0000
|
||||
@@ -60,7 +60,7 @@
|
||||
char msgs[NMESSAGES][DCOLS] = {"", "", "", "", ""};
|
||||
short msg_col = 0, imsg = -1;
|
||||
boolean msg_cleared = 1, rmsg = 0;
|
||||
-char hunger_str[8] = "";
|
||||
+char hunger_str[HUNGER_STR_LEN] = "";
|
||||
const char *more = "-more-";
|
||||
|
||||
extern boolean cant_int, did_int, interrupted, save_is_interactive, flush;
|
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/move.c 30 Nov 1999 03:49:24 -0000 1.7
|
||||
+++ rogue/move.c 21 Aug 2003 20:02:38 -0000
|
||||
@@ -64,7 +64,6 @@
|
||||
extern short cur_level, max_level;
|
||||
extern short bear_trap, haste_self, confused;
|
||||
extern short e_rings, regeneration, auto_search;
|
||||
-extern char hunger_str[];
|
||||
extern boolean being_held, interrupted, r_teleport, passgo;
|
||||
|
||||
one_move_rogue(dirch, pickup)
|
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/object.c 30 Nov 1999 03:49:25 -0000 1.5
|
||||
+++ rogue/object.c 21 Aug 2003 20:04:13 -0000
|
||||
@@ -159,7 +159,6 @@
|
||||
|
||||
extern short cur_level, max_level;
|
||||
extern short party_room;
|
||||
-extern char *error_file;
|
||||
extern boolean is_wood[];
|
||||
|
||||
put_objects()
|
@ -1,13 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/pack.c 30 Nov 1999 03:49:25 -0000 1.8
|
||||
+++ rogue/pack.c 21 Aug 2003 20:07:28 -0000
|
||||
@@ -342,7 +342,7 @@
|
||||
char desc[DCOLS];
|
||||
|
||||
if (rogue.armor) {
|
||||
- message("your already wearing some", 0);
|
||||
+ message("you're already wearing some", 0);
|
||||
return;
|
||||
}
|
||||
ch = pack_letter("wear what?", ARMOR);
|
@ -1,28 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/rogue.h 17 Dec 2001 12:43:23 -0000 1.3.2.1
|
||||
+++ rogue/rogue.h 21 Aug 2003 20:04:36 -0000
|
||||
@@ -194,9 +194,12 @@
|
||||
|
||||
#define MAX_OPT_LEN 40
|
||||
|
||||
+#define HUNGER_STR_LEN 8
|
||||
+
|
||||
+#define MAX_ID_TITLE_LEN 64
|
||||
struct id {
|
||||
short value;
|
||||
- char *title;
|
||||
+ char title[MAX_ID_TITLE_LEN];
|
||||
char *real;
|
||||
unsigned short id_status;
|
||||
};
|
||||
@@ -472,3 +475,9 @@
|
||||
short second; /* 0 - 59 */
|
||||
};
|
||||
|
||||
+/*
|
||||
+ * external routine declarations.
|
||||
+ */
|
||||
+extern char hunger_str[HUNGER_STR_LEN];
|
||||
+extern char login_name[MAX_OPT_LEN];
|
||||
+extern const char *error_file;
|
@ -1,82 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/save.c 30 Nov 1999 03:49:27 -0000 1.6
|
||||
+++ rogue/save.c 21 Aug 2003 20:03:37 -0000
|
||||
@@ -63,8 +63,6 @@
|
||||
|
||||
extern boolean detect_monster;
|
||||
extern short cur_level, max_level;
|
||||
-extern char hunger_str[];
|
||||
-extern char login_name[];
|
||||
extern short party_room;
|
||||
extern short foods;
|
||||
extern boolean is_wood[];
|
||||
@@ -102,15 +100,23 @@
|
||||
{
|
||||
FILE *fp;
|
||||
int file_id;
|
||||
- char name_buffer[80];
|
||||
+ char *name_buffer;
|
||||
+ size_t len;
|
||||
char *hptr;
|
||||
struct rogue_time rt_buf;
|
||||
|
||||
if (sfile[0] == '~') {
|
||||
if (hptr = md_getenv("HOME")) {
|
||||
- (void) strcpy(name_buffer, hptr);
|
||||
- (void) strcat(name_buffer, sfile+1);
|
||||
- sfile = name_buffer;
|
||||
+ len = strlen(hptr) + strlen(sfile);
|
||||
+ name_buffer = md_malloc(len);
|
||||
+ if (name_buffer == NULL) {
|
||||
+ message("out of memory for save file name", 0);
|
||||
+ sfile = error_file;
|
||||
+ } else {
|
||||
+ (void) strcpy(name_buffer, hptr);
|
||||
+ (void) strcat(name_buffer, sfile+1);
|
||||
+ sfile = name_buffer;
|
||||
+ }
|
||||
}
|
||||
}
|
||||
/* revoke */
|
||||
@@ -199,10 +205,10 @@
|
||||
r_read(fp, (char *) &detect_monster, sizeof(detect_monster));
|
||||
r_read(fp, (char *) &cur_level, sizeof(cur_level));
|
||||
r_read(fp, (char *) &max_level, sizeof(max_level));
|
||||
- read_string(hunger_str, fp);
|
||||
+ read_string(hunger_str, fp, sizeof hunger_str);
|
||||
|
||||
- (void) strcpy(tbuf, login_name);
|
||||
- read_string(login_name, fp);
|
||||
+ (void) strlcpy(tbuf, login_name, sizeof tbuf);
|
||||
+ read_string(login_name, fp, sizeof login_name);
|
||||
if (strcmp(tbuf, login_name)) {
|
||||
clean_up("you're not the original player");
|
||||
}
|
||||
@@ -345,7 +351,7 @@
|
||||
r_read(fp, (char *) &(id_table[i].value), sizeof(short));
|
||||
r_read(fp, (char *) &(id_table[i].id_status),
|
||||
sizeof(unsigned short));
|
||||
- read_string(id_table[i].title, fp);
|
||||
+ read_string(id_table[i].title, fp, MAX_ID_TITLE_LEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -362,13 +368,16 @@
|
||||
r_write(fp, s, n);
|
||||
}
|
||||
|
||||
-read_string(s, fp)
|
||||
+read_string(s, fp, len)
|
||||
char *s;
|
||||
FILE *fp;
|
||||
+size_t len;
|
||||
{
|
||||
short n;
|
||||
|
||||
r_read(fp, (char *) &n, sizeof(short));
|
||||
+ if (n > len)
|
||||
+ clean_up("read_string: corrupt game file");
|
||||
r_read(fp, s, n);
|
||||
xxxx(s, n);
|
||||
}
|
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/score.c 30 Nov 1999 03:49:27 -0000 1.4
|
||||
+++ rogue/score.c 21 Aug 2003 20:03:30 -0000
|
||||
@@ -58,7 +58,6 @@
|
||||
#include "rogue.h"
|
||||
#include "pathnames.h"
|
||||
|
||||
-extern char login_name[];
|
||||
extern char *m_names[];
|
||||
extern short max_level;
|
||||
extern boolean score_only, no_skull, msg_cleared;
|
@ -1,12 +0,0 @@
|
||||
$FreeBSD$
|
||||
|
||||
--- rogue/use.c 30 Nov 1999 03:49:29 -0000 1.4
|
||||
+++ rogue/use.c 21 Aug 2003 20:06:00 -0000
|
||||
@@ -68,7 +68,6 @@
|
||||
const char *strange_feeling = "you have a strange feeling for a moment, then it passes";
|
||||
|
||||
extern short bear_trap;
|
||||
-extern char hunger_str[];
|
||||
extern short cur_room;
|
||||
extern long level_points[];
|
||||
extern boolean being_held;
|
@ -1,10 +0,0 @@
|
||||
--- sail/dr_1.c.orig Sat Jul 26 00:11:20 2003
|
||||
+++ sail/dr_1.c Sat Jul 26 00:11:33 2003
|
||||
@@ -40,6 +40,7 @@
|
||||
#endif /* not lint */
|
||||
|
||||
#include "driver.h"
|
||||
+#include "misc.h"
|
||||
|
||||
unfoul()
|
||||
{
|
@ -1,10 +0,0 @@
|
||||
--- sail/misc.c.orig Sat Jul 26 00:09:23 2003
|
||||
+++ sail/misc.c Sat Jul 26 00:09:38 2003
|
||||
@@ -41,6 +41,7 @@
|
||||
|
||||
#include "externs.h"
|
||||
#include "pathnames.h"
|
||||
+#include "misc.h"
|
||||
|
||||
#define distance(x,y) (abs(x) >= abs(y) ? abs(x) + abs(y)/2 : abs(y) + abs(x)/2)
|
||||
|
@ -1,10 +0,0 @@
|
||||
--- sail/pl_1.c.orig Sat Jul 26 00:10:30 2003
|
||||
+++ sail/pl_1.c Sat Jul 26 00:10:42 2003
|
||||
@@ -40,6 +40,7 @@
|
||||
#endif /* not lint */
|
||||
|
||||
#include "player.h"
|
||||
+#include "misc.h"
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
@ -1,28 +0,0 @@
|
||||
--- trek/utility.c.orig Sat Jul 26 00:02:02 2003
|
||||
+++ trek/utility.c Sat Jul 26 00:14:18 2003
|
||||
@@ -43,7 +43,7 @@
|
||||
** ASSORTED UTILITY ROUTINES
|
||||
*/
|
||||
#include <stdio.h>
|
||||
-#include <varargs.h>
|
||||
+#include <stdarg.h>
|
||||
|
||||
/*
|
||||
** BLOCK MOVE
|
||||
@@ -143,14 +143,12 @@
|
||||
** SYSTEM ERROR
|
||||
*/
|
||||
|
||||
-syserr(fmt, va_alist)
|
||||
-const char *fmt;
|
||||
-va_dcl
|
||||
+syserr(char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
extern int errno;
|
||||
|
||||
- va_start(ap);
|
||||
+ va_start(ap,fmt);
|
||||
printf("\n\07TREK SYSERR: ");
|
||||
vfprintf(stdout, fmt, ap);
|
||||
printf("\n");
|
Loading…
Reference in New Issue
Block a user