aboutsummaryrefslogtreecommitdiff
path: root/games/tetrinet
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2020-09-30 11:58:39 +0000
committerStefan Eßer <se@FreeBSD.org>2020-09-30 11:58:39 +0000
commit4f3a17bfc0c44495657bfb9c46bfdc891819e54f (patch)
treee49134ed5bfeeb003bc4a5db01e9d15a91d4127b /games/tetrinet
parent8c5eefad829d8e20bce543692bbc60f24a655ded (diff)
downloadports-4f3a17bfc0c44495657bfb9c46bfdc891819e54f.tar.gz
ports-4f3a17bfc0c44495657bfb9c46bfdc891819e54f.zip
Fix build with -fno-common
While here fix compiler warnings including one out-of-bounds array access.
Notes
Notes: svn path=/head/; revision=550689
Diffstat (limited to 'games/tetrinet')
-rw-r--r--games/tetrinet/Makefile9
-rw-r--r--games/tetrinet/files/patch-server.c20
-rw-r--r--games/tetrinet/files/patch-tetrinet.c11
-rw-r--r--games/tetrinet/files/patch-tetris.h11
-rw-r--r--games/tetrinet/files/patch-tty.c29
5 files changed, 77 insertions, 3 deletions
diff --git a/games/tetrinet/Makefile b/games/tetrinet/Makefile
index 9957cb9f161d..6111d974db0f 100644
--- a/games/tetrinet/Makefile
+++ b/games/tetrinet/Makefile
@@ -3,12 +3,15 @@
PORTNAME= tetrinet
PORTVERSION= 0.11
+PORTREVISION= 1
CATEGORIES= games net
MASTER_SITES= http://tetrinet.or.cz/download/
MAINTAINER= ports@FreeBSD.org
COMMENT= Console tetrinet client
+LICENSE= PD
+
USES= ncurses
MAKE_ARGS= CC="${CC}" CFLAGS="${CFLAGS} -DHAVE_IPV6 -fno-builtin-log"
PLIST_FILES= bin/tetrinet bin/tetrinet-server
@@ -21,16 +24,16 @@ OPTIONS_DEFINE= DOCS
PORTDOCS= README tetrinet.txt
.endif
-post-patch:
+pre-build:
@${REINPLACE_CMD} -e '/-log/n; s/[[:<:]]log[[:>:]]/dolog/g' \
${WRKSRC}/tetrinet.h ${WRKSRC}/tetrinet.c ${WRKSRC}/sockets.c
do-install:
- @${INSTALL_PROGRAM} ${WRKSRC}/tetrinet ${WRKSRC}/tetrinet-server \
+ ${INSTALL_PROGRAM} ${WRKSRC}/tetrinet ${WRKSRC}/tetrinet-server \
${STAGEDIR}${PREFIX}/bin
.if ${PORT_OPTIONS:MDOCS}
@${MKDIR} ${STAGEDIR}${DOCSDIR}
- @${INSTALL_DATA} ${WRKSRC}/README ${WRKSRC}/tetrinet.txt \
+ ${INSTALL_DATA} ${WRKSRC}/README ${WRKSRC}/tetrinet.txt \
${STAGEDIR}${DOCSDIR}
.endif
diff --git a/games/tetrinet/files/patch-server.c b/games/tetrinet/files/patch-server.c
new file mode 100644
index 000000000000..c78a2152f243
--- /dev/null
+++ b/games/tetrinet/files/patch-server.c
@@ -0,0 +1,20 @@
+--- server.c.orig 2003-09-07 16:29:29 UTC
++++ server.c
+@@ -839,7 +839,7 @@ static void check_sockets()
+
+ if (listen_sock >= 0 && FD_ISSET(listen_sock, &fds)) {
+ struct sockaddr_in sin;
+- int len = sizeof(sin);
++ socklen_t len = sizeof(sin);
+ fd = accept(listen_sock, (struct sockaddr *)&sin, &len);
+ if (fd >= 0) {
+ for (i = 0; i < 6 && player_socks[i] != -1; i++)
+@@ -857,7 +857,7 @@ static void check_sockets()
+ #ifdef HAVE_IPV6
+ if (listen_sock6 >= 0 && FD_ISSET(listen_sock6, &fds)) {
+ struct sockaddr_in6 sin6;
+- int len = sizeof(sin6);
++ socklen_t len = sizeof(sin6);
+ fd = accept(listen_sock6, (struct sockaddr *)&sin6, &len);
+ if (fd >= 0) {
+ for (i = 0; i < 6 && player_socks[i] != -1; i++)
diff --git a/games/tetrinet/files/patch-tetrinet.c b/games/tetrinet/files/patch-tetrinet.c
new file mode 100644
index 000000000000..b31084ba5de3
--- /dev/null
+++ b/games/tetrinet/files/patch-tetrinet.c
@@ -0,0 +1,11 @@
+--- tetrinet.c.orig 2003-10-05 18:39:24 UTC
++++ tetrinet.c
+@@ -83,7 +83,7 @@ void parse(char *buf)
+ winlist[i].team = 0;
+ s++;
+ strncpy(winlist[i].name, s, sizeof(winlist[i].name)-1);
+- winlist[i].name[sizeof(winlist[i].name)] = 0;
++ winlist[i].name[sizeof(winlist[i].name)-1] = 0;
+ winlist[i].points = atoi(t);
+ if ((t = strchr(t, ';')) != NULL)
+ winlist[i].games = atoi(t+1);
diff --git a/games/tetrinet/files/patch-tetris.h b/games/tetrinet/files/patch-tetris.h
new file mode 100644
index 000000000000..1c916eb3e644
--- /dev/null
+++ b/games/tetrinet/files/patch-tetris.h
@@ -0,0 +1,11 @@
+--- tetris.h.orig 2003-09-07 16:29:29 UTC
++++ tetris.h
+@@ -50,7 +50,7 @@ typedef struct {
+ char shape[4][4]; /* Shape data for the piece */
+ } PieceData;
+
+-PieceData piecedata[7][4];
++extern PieceData piecedata[7][4];
+
+ extern int current_piece, current_rotation;
+
diff --git a/games/tetrinet/files/patch-tty.c b/games/tetrinet/files/patch-tty.c
new file mode 100644
index 000000000000..00d090e0bc9e
--- /dev/null
+++ b/games/tetrinet/files/patch-tty.c
@@ -0,0 +1,29 @@
+--- tty.c.orig 2003-10-24 10:48:27 UTC
++++ tty.c
+@@ -550,7 +550,7 @@ static void setup_fields(void)
+ mvaddstr(y, x-1, buf);
+ for (i = 2; i < FIELD_HEIGHT*2 && players[my_playernum-1][i-2]; i++)
+ mvaddch(y+i, x-1, players[my_playernum-1][i-2]);
+- if (teams[my_playernum-1] != '\0') {
++ if (teams[my_playernum-1] != NULL) {
+ mvaddstr(y, x+FIELD_WIDTH*2+2, "T");
+ for (i = 2; i < FIELD_HEIGHT*2 && teams[my_playernum-1][i-2]; i++)
+ mvaddch(y+i, x+FIELD_WIDTH*2+2, teams[my_playernum-1][i-2]);
+@@ -586,7 +586,7 @@ static void setup_fields(void)
+ if (players[j+1]) {
+ for (i = 0; i < FIELD_HEIGHT-2 && players[j+1][i]; i++)
+ mvaddch(y+i+2, x-1, players[j+1][i]);
+- if (teams[j+1] != '\0') {
++ if (teams[j+1] != NULL) {
+ mvaddstr(y, x+FIELD_WIDTH+2, "T");
+ for (i = 0; i < FIELD_HEIGHT-2 && teams[j+1][i]; i++)
+ mvaddch(y+i+2, x+FIELD_WIDTH+2, teams[j+1][i]);
+@@ -599,7 +599,7 @@ static void setup_fields(void)
+ if (players[j]) {
+ for (i = 0; i < FIELD_HEIGHT-2 && players[j][i]; i++)
+ mvaddch(y+i+2, x-1, players[j][i]);
+- if (teams[j] != '\0') {
++ if (teams[j] != NULL) {
+ mvaddstr(y, x+FIELD_WIDTH+2, "T");
+ for (i = 0; i < FIELD_HEIGHT-2 && teams[j][i]; i++)
+ mvaddch(y+i+2, x+FIELD_WIDTH+2, teams[j][i]);