games/powwow: update 1.2.17 -> 1.2.22

PR:		247902
Submitted by:	Juraj Lutter <juraj@lutter.sk> (maintainer)
Relnotes:	https://www.hoopajoo.net/projects/powwow.html
		https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=247902#c0
This commit is contained in:
Kurt Jaeger 2020-07-24 15:17:00 +00:00
parent b5a9c8e19a
commit d603c20909
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=543247
12 changed files with 183 additions and 203 deletions

View file

@ -2,32 +2,35 @@
# $FreeBSD$
PORTNAME= powwow
PORTVERSION= 1.2.17
PORTREVISION= 1
PORTVERSION= 1.2.22
CATEGORIES= games
MASTER_SITES= http://hoopajoo.net/static/projects/ \
ftp://ftp.wilbury.sk/pub/FreeBSD/local/distfiles/
MASTER_SITES= https://hoopajoo.net/static/projects/ \
https://ftp.sk.FreeBSD.org/pub/FreeBSD/local/distfiles/
MAINTAINER= juraj@lutter.sk
COMMENT= Client to play MUDs
USES= ncurses
GNU_CONFIGURE= yes
LICENSE= GPLv2
pre-build:
@${REINPLACE_CMD} -e 's|malloc.h|stdlib.h|' ${WRKSRC}/defines.h \
${WRKSRC}/list.c ${WRKSRC}/main.c ${WRKSRC}/cmd2.c ${WRKSRC}/beam.c
@${REINPLACE_CMD} -e 's|^DEFS = |DEFS = -DPOSIX |' ${WRKSRC}/Makefile
USES= gmake ncurses
GNU_CONFIGURE= yes
CONFIGURE_ARGS+= --enable-bsd
OPTIONS_DEFINE= DOCS
OPTIONS_SUB= 1
.include <bsd.port.options.mk>
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/powwow ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/powwow-movieplay ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/powwow-muc ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/catrw ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/follow ${STAGEDIR}${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/powwow.6 ${STAGEDIR}${PREFIX}/man/man6
@${MKDIR} ${STAGEDIR}${DATADIR}
${INSTALL_DATA} ${WRKSRC}/powwow.doc ${STAGEDIR}${DATADIR}
${INSTALL_DATA} ${WRKSRC}/powwow.help ${STAGEDIR}${DATADIR}
${INSTALL_PROGRAM} ${WRKSRC}/src/powwow ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/src/powwow-movieplay ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/src/powwow-muc ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/src/catrw ${STAGEDIR}${PREFIX}/bin
${INSTALL_PROGRAM} ${WRKSRC}/src/follow ${STAGEDIR}${PREFIX}/bin
${MKDIR} ${STAGEDIR}${MAN6PREFIX}/man/man6
${INSTALL_MAN} ${WRKSRC}/man/powwow.6 ${STAGEDIR}${MAN6PREFIX}/man/man6
${MKDIR} ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/doc/powwow.doc ${STAGEDIR}${DOCSDIR}
${INSTALL_DATA} ${WRKSRC}/doc/powwow.help ${STAGEDIR}${DOCSDIR}
.include <bsd.port.mk>

View file

@ -1,2 +1,3 @@
SHA256 (powwow-1.2.17.tar.gz) = e8dee1fe9cd6b59cfa20e3e7ef4eb49775b72b80d1d298e23172337cbc78baf6
SIZE (powwow-1.2.17.tar.gz) = 308660
TIMESTAMP = 1594413553
SHA256 (powwow-1.2.22.tar.gz) = 77b1158a26a907a5f7c07c619605c99c572a3c46ba46d3d26a1bbdfed10a218a
SIZE (powwow-1.2.22.tar.gz) = 339521

View file

@ -1,65 +0,0 @@
Index: follow.c
@@ -13,7 +13,9 @@
#include <sys/time.h>
#include <sys/types.h>
-#ifndef USE_SGTTY
+#ifdef POSIX
+# include <termios.h>
+#elif !defined(USE_SGTTY)
# ifdef APOLLO
# include "/sys5.3/usr/include/sys/termio.h"
# else
@@ -44,6 +46,9 @@
# define O_CBREAK CBREAK
#endif
+#ifdef POSIX
+typedef struct termios termiostruct;
+#else
#if defined(TCSETS) || defined(TCSETATTR)
# ifndef TCSETS /* cc for HP-UX SHOULD define this... */
# define TCSETS TCSETATTR
@@ -55,6 +60,7 @@
# define TCGETS TCGETA
typedef struct termio termiostruct;
#endif
+#endif /* POSIX */
#ifdef VSUSP
# define O_SUSP VSUSP
@@ -102,14 +108,22 @@
ioctl(0, TIOCSLTC, &ltc);
#else /* not USE_SGTTY */
termiostruct ttyb;
+#if POSIX
+ tcgetattr(0, &ttyb);
+#else
ioctl(0, TCGETS, &ttyb);
+#endif
ttybsave = ttyb;
ttyb.c_lflag &= ~(ECHO|ICANON);
ttyb.c_cc[VTIME] = 0;
ttyb.c_cc[VMIN] = 1;
/* disable the special handling of the suspend key (handle it ourselves) */
ttyb.c_cc[O_SUSP] = 0;
+#if POSIX
+ tcsetattr(0, TCSANOW, &ttyb);
+#else
ioctl(0, TCSETS, &ttyb);
+#endif
#endif /* USE_SGTTY */
}
@@ -123,7 +137,11 @@
ioctl(0, TIOCSETC, &tcsave);
ioctl(0, TIOCSLTC, &ltcsave);
#else /* not USE_SGTTY */
+#if POSIX
+ tcsetattr(0, TCSANOW, &ttybsave);
+#else
ioctl(0, TCSETS, &ttybsave);
+#endif
#endif /* USE_SGTTY */
}

View file

@ -1,17 +0,0 @@
Index: ptr.c
@@ -407,6 +407,7 @@
return (char*)p; /* shortcut for NULL */
}
+#ifdef _GNU_SOURCE
/*
* find last occurrence of c in p
* return NULL if none found.
@@ -427,6 +428,7 @@
else
return NULL;
}
+#endif
char *ptrrchr __P2 (ptr,p, char,c)
{

View file

@ -1,10 +0,0 @@
Index: ptr.h
@@ -65,7 +65,7 @@
/* TODO: watch memrchr, it is defined differently here than under _GNU_SOURCE,
* so it could cause bizarre results if a module makes use of a library that
* uses it */
-char *memrchr __P ((char *p, int lenp, char c));
+//char *memrchr __P ((char *p, int lenp, char c));
#endif
#endif /* _PTR_H_ */

View file

@ -0,0 +1,13 @@
--- src/follow.c.orig 2020-07-10 21:06:39 UTC
+++ src/follow.c
@@ -8,6 +8,10 @@
*
*/
+#ifdef BSD_LIKE
+#define COMPAT_43TTY
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View file

@ -0,0 +1,29 @@
--- src/ptr.c.orig 2020-07-01 02:48:35 UTC
+++ src/ptr.c
@@ -10,6 +10,10 @@
*
*/
+#ifdef BSD_LIKE
+#define __BSD_VISIBLE 1
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -415,6 +419,7 @@ char *ptrchr(ptr p, char c)
return (char*)p; /* shortcut for NULL */
}
+#ifdef _GNU_SOURCE
/*
* find last occurrence of c in p
* return NULL if none found.
@@ -435,6 +440,7 @@ char *memrchr(char *p, int lenp, char c)
else
return NULL;
}
+#endif
char *ptrrchr(ptr p, char c)
{

View file

@ -0,0 +1,16 @@
--- src/ptr.h.orig 2020-07-10 20:58:54 UTC
+++ src/ptr.h
@@ -64,12 +64,12 @@ char *memchrs(char *p, int lenp, char *q, int lenq);
char *memrchrs(char *p, int lenp, char *q, int lenq);
#ifdef _GNU_SOURCE
# define memfind memmem
+char *memrchr(char *p, int lenp, char c);
#else
char *memfind(char *hay, int haylen, char *needle, int needlelen);
/* TODO: watch memrchr, it is defined differently here than under _GNU_SOURCE,
* so it could cause bizarre results if a module makes use of a library that
* uses it */
-char *memrchr(char *p, int lenp, char c);
#endif
#endif /* _PTR_H_ */

View file

@ -0,0 +1,84 @@
--- src/tty.c.orig 2019-11-06 05:25:17 UTC
+++ src/tty.c
@@ -9,7 +9,12 @@
* (at your option) any later version.
*
*/
-#include <alloca.h>
+
+#ifdef BSD_LIKE
+#define COMPAT_43TTY 1
+#define __BSD_VISIBLE 1
+#endif
+
#include <assert.h>
#include <errno.h>
#include <fcntl.h>
@@ -847,31 +852,25 @@ again:
int tty_printf(const char *format, ...)
{
- char buf[1024], *bufp = buf;
+ char *bufp;
+ char *old_locale;
va_list va;
int res;
- char *old_locale = strdup(setlocale(LC_ALL, NULL));
+ if ((old_locale = strdup(setlocale(LC_ALL, NULL))) == NULL)
+ return -1;
setlocale(LC_ALL, "C");
-
va_start(va, format);
- res = vsnprintf(buf, sizeof buf, format, va);
+ res = vasprintf(&bufp, format, va);
va_end(va);
-
- if (res >= sizeof buf) {
- bufp = alloca(res + 1);
- va_start(va, format);
- vsprintf(bufp, format, va);
- assert(strlen(bufp) == res);
- va_end(va);
- }
-
+ if (res < 0)
+ goto out;
setlocale(LC_ALL, old_locale);
- free(old_locale);
-
tty_puts(bufp);
-
+ free(bufp);
+out:
+ free(old_locale);
return res;
}
@@ -968,16 +967,23 @@ int tty_read(char *buf, size_t count)
void tty_gets(char *s, int size)
{
- wchar_t *ws = alloca(size * sizeof *ws);
+ wchar_t *ws = NULL;
+ if ((ws = malloc(size * sizeof *ws)) == NULL)
+ goto out;;
+
if (!fgetws(ws, size, stdin))
- return;
+ goto out;
while (*ws) {
if (!(*ws & ~0xff))
*s++ = (unsigned char)*ws;
++ws;
}
+out:
+ if (ws != NULL)
+ free(ws);
+ return;
}
void tty_flush(void)

View file

@ -0,0 +1,14 @@
--- src/utils.c.orig 2020-07-10 20:54:00 UTC
+++ src/utils.c
@@ -12,9 +12,9 @@
#ifdef BSD_LIKE
/* Needed for SIGWINCH on OpenBSD. */
-# define _BSD_SOURCE
+# define _BSD_SOURCE 1
/* Needed for SIGWINCH on FreeBSD. */
-# define __BSD_VISIBLE
+# define __BSD_VISIBLE 1
/* Needed for SIGWINCH on Darwin. */
# define _DARWIN_C_SOURCE 1
#endif

View file

@ -1,88 +0,0 @@
Index: tty.c
@@ -33,7 +33,9 @@
#include "tty.h"
#include "tcp.h"
-#ifndef USE_SGTTY
+#ifdef POSIX
+# include <termios.h>
+#elif !defined(USE_SGTTY)
# ifdef APOLLO
# include "/sys5.3/usr/include/sys/termio.h"
# else
@@ -64,6 +66,9 @@
# define O_CBREAK CBREAK
#endif
+#ifdef POSIX
+typedef struct termios termiostruct;
+#else
#if defined(TCSETS) || defined(TCSETATTR)
# ifndef TCSETS /* cc for HP-UX SHOULD define this... */
# define TCSETS TCSETATTR
@@ -75,6 +80,7 @@
# define TCGETS TCGETA
typedef struct termio termiostruct;
#endif
+#endif /* POSIX */
#ifdef VSUSP
# define O_SUSP VSUSP
@@ -181,14 +187,22 @@
ioctl(tty_read_fd, TIOCSLTC, &ltc);
#else /* not USE_SGTTY */
termiostruct ttyb;
+#if POSIX
+ tcgetattr(tty_read_fd, &ttyb);
+#else
ioctl(tty_read_fd, TCGETS, &ttyb);
+#endif
ttybsave = ttyb;
ttyb.c_lflag &= ~(ECHO|ICANON);
ttyb.c_cc[VTIME] = 0;
ttyb.c_cc[VMIN] = 1;
/* disable the special handling of the suspend key (handle it ourselves) */
ttyb.c_cc[O_SUSP] = 0;
+#if POSIX
+ tcsetattr(tty_read_fd, TCSANOW, &ttyb);
+#else
ioctl(tty_read_fd, TCSETS, &ttyb);
+#endif
#endif /* USE_SGTTY */
#ifdef USE_LOCALE
@@ -216,7 +230,11 @@
ioctl(tty_read_fd, TIOCSETC, &tcsave);
ioctl(tty_read_fd, TIOCSLTC, &ltcsave);
#else /* not USE_SGTTY */
+#if POSIX
+ tcsetattr(tty_read_fd, TCSANOW, &ttybsave);
+#else
ioctl(tty_read_fd, TCSETS, &ttybsave);
+#endif
#endif /* USE_SGTTY */
tty_puts(kpadend);
tty_flush();
@@ -251,7 +269,11 @@
#else /* not USE_SGTTY */
int i;
termiostruct ttyb;
+#if POSIX
+ tcgetattr(tty_read_fd, &ttyb);
+#else
ioctl(tty_read_fd, TCGETS, &ttyb);
+#endif
if (linemode & LM_CHAR) {
/* char-by-char mode: disable all special keys and set raw mode */
for(i = 0; i < NCCS; i++)
@@ -266,7 +288,11 @@
/* set cooked mode */
ttyb.c_oflag |= OPOST;
}
+#if POSIX
+ tcsetattr(tty_read_fd, TCSANOW, &ttyb);
+#else
ioctl(tty_read_fd, TCSETS, &ttyb);
+#endif
#endif /* USE_SGTTY */
}

View file

@ -4,5 +4,5 @@ bin/powwow
bin/powwow-movieplay
bin/powwow-muc
man/man6/powwow.6.gz
%%DATADIR%%/powwow.doc
%%DATADIR%%/powwow.help
%%PORTDOCS%%%%DOCSDIR%%/powwow.doc
%%PORTDOCS%%%%DOCSDIR%%/powwow.help