View | Details | Raw Unified | Return to bug 247902
Collapse All | Expand All

(-)b/games/powwow/Makefile (-18 / +23 lines)
Lines 2-32 Link Here
2
# $FreeBSD$
2
# $FreeBSD$
3
3
4
PORTNAME=	powwow
4
PORTNAME=	powwow
5
PORTVERSION=	1.2.17
5
PORTVERSION=	1.2.22
6
CATEGORIES=	games
6
CATEGORIES=	games
7
MASTER_SITES=	http://hoopajoo.net/static/projects/ \
7
MASTER_SITES=	https://hoopajoo.net/static/projects/ \
8
		ftp://ftp.wilbury.sk/pub/FreeBSD/local/distfiles/
8
		https://ftp.sk.FreeBSD.org/pub/FreeBSD/local/distfiles/
9
9
10
MAINTAINER=	otis@sk.FreeBSD.org
10
MAINTAINER=	juraj@lutter.sk
11
COMMENT=	Client to play MUDs
11
COMMENT=	Client to play MUDs
12
12
13
USES=		ncurses
13
LICENSE=	GPLv2
14
15
USES=		gmake ncurses
14
GNU_CONFIGURE=	yes
16
GNU_CONFIGURE=	yes
15
17
16
pre-build:
18
CONFIGURE_ARGS+=	--enable-bsd
17
	@${REINPLACE_CMD} -e 's|malloc.h|stdlib.h|' ${WRKSRC}/defines.h \
19
18
		${WRKSRC}/list.c ${WRKSRC}/main.c ${WRKSRC}/cmd2.c ${WRKSRC}/beam.c
20
OPTIONS_DEFINE=		DOCS
19
	@${REINPLACE_CMD} -e 's|^DEFS = |DEFS = -DPOSIX |' ${WRKSRC}/Makefile
21
OPTIONS_SUB=		1
22
23
.include <bsd.port.options.mk>
20
24
21
do-install:
25
do-install:
22
	${INSTALL_PROGRAM} ${WRKSRC}/powwow ${STAGEDIR}${PREFIX}/bin
26
	${INSTALL_PROGRAM} ${WRKSRC}/src/powwow ${STAGEDIR}${PREFIX}/bin
23
	${INSTALL_PROGRAM} ${WRKSRC}/powwow-movieplay ${STAGEDIR}${PREFIX}/bin
27
	${INSTALL_PROGRAM} ${WRKSRC}/src/powwow-movieplay ${STAGEDIR}${PREFIX}/bin
24
	${INSTALL_PROGRAM} ${WRKSRC}/powwow-muc ${STAGEDIR}${PREFIX}/bin
28
	${INSTALL_PROGRAM} ${WRKSRC}/src/powwow-muc ${STAGEDIR}${PREFIX}/bin
25
	${INSTALL_PROGRAM} ${WRKSRC}/catrw ${STAGEDIR}${PREFIX}/bin
29
	${INSTALL_PROGRAM} ${WRKSRC}/src/catrw ${STAGEDIR}${PREFIX}/bin
26
	${INSTALL_PROGRAM} ${WRKSRC}/follow ${STAGEDIR}${PREFIX}/bin
30
	${INSTALL_PROGRAM} ${WRKSRC}/src/follow ${STAGEDIR}${PREFIX}/bin
27
	${INSTALL_MAN} ${WRKSRC}/powwow.6 ${STAGEDIR}${PREFIX}/man/man6
31
	@${MKDIR} ${STAGEDIR}${MAN6PREFIX}/man/man6
28
	@${MKDIR} ${STAGEDIR}${DATADIR}
32
	${INSTALL_MAN} ${WRKSRC}/man/powwow.6 ${STAGEDIR}${MAN6PREFIX}/man/man6
29
	${INSTALL_DATA} ${WRKSRC}/powwow.doc ${STAGEDIR}${DATADIR}
33
	@${MKDIR} ${STAGEDIR}${DOCSDIR}
30
	${INSTALL_DATA} ${WRKSRC}/powwow.help ${STAGEDIR}${DATADIR}
34
	${INSTALL_DATA} ${WRKSRC}/doc/powwow.doc ${STAGEDIR}${DOCSDIR}
35
	${INSTALL_DATA} ${WRKSRC}/doc/powwow.help ${STAGEDIR}${DOCSDIR}
31
36
32
.include <bsd.port.mk>
37
.include <bsd.port.mk>
(-)b/games/powwow/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (powwow-1.2.17.tar.gz) = e8dee1fe9cd6b59cfa20e3e7ef4eb49775b72b80d1d298e23172337cbc78baf6
1
TIMESTAMP = 1594413553
2
SIZE (powwow-1.2.17.tar.gz) = 308660
2
SHA256 (powwow-1.2.22.tar.gz) = 77b1158a26a907a5f7c07c619605c99c572a3c46ba46d3d26a1bbdfed10a218a
3
SIZE (powwow-1.2.22.tar.gz) = 339521
(-)a/games/powwow/files/patch-follow.c (-65 lines)
Removed Link Here
1
Index: follow.c
2
@@ -13,7 +13,9 @@
3
 #include <sys/time.h>
4
 #include <sys/types.h>
5
 
6
-#ifndef USE_SGTTY
7
+#ifdef POSIX
8
+#    include <termios.h>
9
+#elif !defined(USE_SGTTY)
10
 # ifdef APOLLO
11
 #  include "/sys5.3/usr/include/sys/termio.h"
12
 # else
13
@@ -44,6 +46,9 @@
14
 # define O_CBREAK CBREAK
15
 #endif
16
 
17
+#ifdef POSIX
18
+typedef struct termios termiostruct;
19
+#else
20
 #if defined(TCSETS) || defined(TCSETATTR)
21
 # ifndef TCSETS		/* cc for HP-UX  SHOULD define this... */
22
 #  define TCSETS TCSETATTR
23
@@ -55,6 +60,7 @@
24
 # define TCGETS TCGETA
25
 typedef struct termio termiostruct;
26
 #endif
27
+#endif /* POSIX */
28
 
29
 #ifdef VSUSP
30
 # define O_SUSP VSUSP
31
@@ -102,14 +108,22 @@
32
     ioctl(0, TIOCSLTC, &ltc);
33
 #else /* not USE_SGTTY */
34
     termiostruct ttyb;
35
+#if POSIX
36
+	tcgetattr(0, &ttyb);
37
+#else
38
     ioctl(0, TCGETS, &ttyb);
39
+#endif
40
     ttybsave = ttyb;
41
     ttyb.c_lflag &= ~(ECHO|ICANON);
42
     ttyb.c_cc[VTIME] = 0;
43
     ttyb.c_cc[VMIN] = 1;
44
     /* disable the special handling of the suspend key (handle it ourselves) */
45
     ttyb.c_cc[O_SUSP] = 0;
46
+#if POSIX
47
+	tcsetattr(0, TCSANOW, &ttyb);
48
+#else
49
     ioctl(0, TCSETS, &ttyb);
50
+#endif
51
 #endif /* USE_SGTTY */
52
 }
53
 
54
@@ -123,7 +137,11 @@
55
     ioctl(0, TIOCSETC, &tcsave);
56
     ioctl(0, TIOCSLTC, &ltcsave);
57
 #else /* not USE_SGTTY */
58
+#if POSIX
59
+	tcsetattr(0, TCSANOW, &ttybsave);
60
+#else
61
     ioctl(0, TCSETS, &ttybsave);
62
+#endif
63
 #endif /* USE_SGTTY */
64
 }
65
 
(-)a/games/powwow/files/patch-ptr.c (-17 lines)
Removed Link Here
1
Index: ptr.c
2
@@ -407,6 +407,7 @@
3
     return (char*)p; /* shortcut for NULL */
4
 }
5
 
6
+#ifdef _GNU_SOURCE
7
 /*
8
  * find last occurrence of c in p
9
  * return NULL if none found.
10
@@ -427,6 +428,7 @@
11
     else
12
 	return NULL;
13
 }
14
+#endif
15
 
16
 char *ptrrchr __P2 (ptr,p, char,c)
17
 {
(-)a/games/powwow/files/patch-ptr.h (-10 lines)
Removed Link Here
1
Index: ptr.h
2
@@ -65,7 +65,7 @@
3
 /* TODO: watch memrchr, it is defined differently here than under _GNU_SOURCE,
4
  * so it could cause bizarre results if a module makes use of a library that
5
  * uses it */
6
-char *memrchr   __P ((char *p, int lenp, char c));
7
+//char *memrchr   __P ((char *p, int lenp, char c));
8
 #endif
9
 
10
 #endif /* _PTR_H_ */
(-)b/games/powwow/files/patch-src_follow.c (+13 lines)
Added Link Here
1
--- src/follow.c.orig	2020-07-10 21:06:39 UTC
2
+++ src/follow.c
3
@@ -8,6 +8,10 @@
4
  *
5
  */
6
 
7
+#ifdef BSD_LIKE
8
+#define COMPAT_43TTY
9
+#endif
10
+
11
 #include <stdio.h>
12
 #include <stdlib.h>
13
 #include <string.h>
(-)b/games/powwow/files/patch-src_ptr.c (+29 lines)
Added Link Here
1
--- src/ptr.c.orig	2020-07-01 02:48:35 UTC
2
+++ src/ptr.c
3
@@ -10,6 +10,10 @@
4
  *
5
  */
6
 
7
+#ifdef BSD_LIKE
8
+#define __BSD_VISIBLE 1
9
+#endif
10
+
11
 #include <stdio.h>
12
 #include <stdlib.h>
13
 #include <string.h>
14
@@ -415,6 +419,7 @@ char *ptrchr(ptr p, char c)
15
     return (char*)p; /* shortcut for NULL */
16
 }
17
 
18
+#ifdef _GNU_SOURCE
19
 /*
20
  * find last occurrence of c in p
21
  * return NULL if none found.
22
@@ -435,6 +440,7 @@ char *memrchr(char *p, int lenp, char c)
23
     else
24
 	return NULL;
25
 }
26
+#endif
27
 
28
 char *ptrrchr(ptr p, char c)
29
 {
(-)b/games/powwow/files/patch-src_ptr.h (+16 lines)
Added Link Here
1
--- src/ptr.h.orig	2020-07-10 20:58:54 UTC
2
+++ src/ptr.h
3
@@ -64,12 +64,12 @@ char *memchrs(char *p, int lenp, char *q, int lenq);
4
 char *memrchrs(char *p, int lenp, char *q, int lenq);
5
 #ifdef _GNU_SOURCE
6
 # define memfind memmem
7
+char *memrchr(char *p, int lenp, char c);
8
 #else
9
 char *memfind(char *hay, int haylen, char *needle, int needlelen);
10
 /* TODO: watch memrchr, it is defined differently here than under _GNU_SOURCE,
11
  * so it could cause bizarre results if a module makes use of a library that
12
  * uses it */
13
-char *memrchr(char *p, int lenp, char c);
14
 #endif
15
 
16
 #endif /* _PTR_H_ */
(-)b/games/powwow/files/patch-src_tty.c (+84 lines)
Added Link Here
1
--- src/tty.c.orig	2019-11-06 05:25:17 UTC
2
+++ src/tty.c
3
@@ -9,7 +9,12 @@
4
  *  (at your option) any later version.
5
  *
6
  */
7
-#include <alloca.h>
8
+
9
+#ifdef BSD_LIKE
10
+#define COMPAT_43TTY 1
11
+#define __BSD_VISIBLE 1
12
+#endif
13
+
14
 #include <assert.h>
15
 #include <errno.h>
16
 #include <fcntl.h>
17
@@ -847,31 +852,25 @@ again:
18
 
19
 int tty_printf(const char *format, ...)
20
 {
21
-    char buf[1024], *bufp = buf;
22
+    char *bufp;
23
+    char *old_locale;
24
     va_list va;
25
     int res;
26
 
27
-    char *old_locale = strdup(setlocale(LC_ALL, NULL));
28
+    if ((old_locale = strdup(setlocale(LC_ALL, NULL))) == NULL)
29
+	    return -1;
30
 
31
     setlocale(LC_ALL, "C");
32
-
33
     va_start(va, format);
34
-    res = vsnprintf(buf, sizeof buf, format, va);
35
+    res = vasprintf(&bufp, format, va);
36
     va_end(va);
37
-
38
-    if (res >= sizeof buf) {
39
-	bufp = alloca(res + 1);
40
-	va_start(va, format);
41
-	vsprintf(bufp, format, va);
42
-        assert(strlen(bufp) == res);
43
-	va_end(va);
44
-    }
45
-
46
+    if (res < 0)
47
+	    goto out;
48
     setlocale(LC_ALL, old_locale);
49
-    free(old_locale);
50
-
51
     tty_puts(bufp);
52
-
53
+    free(bufp);
54
+out:
55
+    free(old_locale);
56
     return res;
57
 }
58
 
59
@@ -968,16 +967,23 @@ int tty_read(char *buf, size_t count)
60
 
61
 void tty_gets(char *s, int size)
62
 {
63
-    wchar_t *ws = alloca(size * sizeof *ws);
64
+    wchar_t *ws = NULL;
65
 
66
+    if ((ws = malloc(size * sizeof *ws)) == NULL)
67
+	    goto out;;
68
+
69
     if (!fgetws(ws, size, stdin))
70
-	return;
71
+	goto out;
72
 
73
     while (*ws) {
74
 	if (!(*ws & ~0xff))
75
 	    *s++ = (unsigned char)*ws;
76
 	++ws;
77
     }
78
+out:
79
+    if (ws != NULL)
80
+	    free(ws);
81
+    return;
82
 }
83
 
84
 void tty_flush(void)
(-)b/games/powwow/files/patch-src_utils.c (+14 lines)
Added Link Here
1
--- src/utils.c.orig	2020-07-10 20:54:00 UTC
2
+++ src/utils.c
3
@@ -12,9 +12,9 @@
4
 
5
 #ifdef BSD_LIKE
6
 /* Needed for SIGWINCH on OpenBSD. */
7
-# define _BSD_SOURCE
8
+# define _BSD_SOURCE 1
9
 /* Needed for SIGWINCH on FreeBSD. */
10
-# define __BSD_VISIBLE
11
+# define __BSD_VISIBLE 1
12
 /* Needed for SIGWINCH on Darwin. */
13
 # define _DARWIN_C_SOURCE 1
14
 #endif
(-)a/games/powwow/files/patch-tty.c (-88 lines)
Removed Link Here
1
Index: tty.c
2
@@ -33,7 +33,9 @@
3
 #include "tty.h"
4
 #include "tcp.h"
5
 
6
-#ifndef USE_SGTTY
7
+#ifdef POSIX
8
+#    include <termios.h>
9
+#elif !defined(USE_SGTTY)
10
 #  ifdef APOLLO
11
 #    include "/sys5.3/usr/include/sys/termio.h"
12
 #  else
13
@@ -64,6 +66,9 @@
14
 #  define O_CBREAK CBREAK
15
 #endif
16
 
17
+#ifdef POSIX
18
+typedef struct termios termiostruct;
19
+#else
20
 #if defined(TCSETS) || defined(TCSETATTR)
21
 #  ifndef TCSETS		/* cc for HP-UX  SHOULD define this... */
22
 #    define TCSETS TCSETATTR
23
@@ -75,6 +80,7 @@
24
 #  define TCGETS TCGETA
25
 typedef struct termio termiostruct;
26
 #endif
27
+#endif /* POSIX */
28
 
29
 #ifdef VSUSP
30
 #  define O_SUSP VSUSP
31
@@ -181,14 +187,22 @@
32
     ioctl(tty_read_fd, TIOCSLTC, &ltc);
33
 #else /* not USE_SGTTY */
34
     termiostruct ttyb;
35
+#if POSIX
36
+	tcgetattr(tty_read_fd, &ttyb);
37
+#else
38
     ioctl(tty_read_fd, TCGETS, &ttyb);
39
+#endif
40
     ttybsave = ttyb;
41
     ttyb.c_lflag &= ~(ECHO|ICANON);
42
     ttyb.c_cc[VTIME] = 0;
43
     ttyb.c_cc[VMIN] = 1;
44
     /* disable the special handling of the suspend key (handle it ourselves) */
45
     ttyb.c_cc[O_SUSP] = 0;
46
+#if POSIX
47
+	tcsetattr(tty_read_fd, TCSANOW, &ttyb);
48
+#else
49
     ioctl(tty_read_fd, TCSETS, &ttyb);
50
+#endif
51
 #endif /* USE_SGTTY */
52
 
53
 #ifdef USE_LOCALE
54
@@ -216,7 +230,11 @@
55
     ioctl(tty_read_fd, TIOCSETC, &tcsave);
56
     ioctl(tty_read_fd, TIOCSLTC, &ltcsave);
57
 #else /* not USE_SGTTY */
58
+#if POSIX
59
+	tcsetattr(tty_read_fd, TCSANOW, &ttybsave);
60
+#else
61
     ioctl(tty_read_fd, TCSETS, &ttybsave);
62
+#endif
63
 #endif /* USE_SGTTY */
64
     tty_puts(kpadend);
65
     tty_flush();
66
@@ -251,7 +269,11 @@
67
 #else /* not USE_SGTTY */
68
     int i;
69
     termiostruct ttyb;
70
+#if POSIX
71
+	tcgetattr(tty_read_fd, &ttyb);
72
+#else
73
     ioctl(tty_read_fd, TCGETS, &ttyb);
74
+#endif
75
     if (linemode & LM_CHAR)  {
76
 	/* char-by-char mode: disable all special keys and set raw mode */
77
 	for(i = 0; i < NCCS; i++)
78
@@ -266,7 +288,11 @@
79
 	/* set cooked mode */
80
 	ttyb.c_oflag |= OPOST;
81
     }
82
+#if POSIX
83
+	tcsetattr(tty_read_fd, TCSANOW, &ttyb);
84
+#else
85
     ioctl(tty_read_fd, TCSETS, &ttyb);
86
+#endif
87
 #endif /* USE_SGTTY */
88
 }
(-)b/games/powwow/pkg-plist (-2 / +2 lines)
Lines 4-8 bin/powwow Link Here
4
bin/powwow-movieplay
4
bin/powwow-movieplay
5
bin/powwow-muc
5
bin/powwow-muc
6
man/man6/powwow.6.gz
6
man/man6/powwow.6.gz
7
%%DATADIR%%/powwow.doc
7
%%PORTDOCS%%%%DOCSDIR%%/powwow.doc
8
%%DATADIR%%/powwow.help
8
%%PORTDOCS%%%%DOCSDIR%%/powwow.help

Return to bug 247902