Date: Mon, 16 Jun 2008 09:52:02 GMT From: Alex Kozlov <spam@rm-rf.kiev.ua> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/124637: [patch] games/powwow up to 1.2.13, sgtty -> termios conversion Message-ID: <200806160952.m5G9q2Ek037423@www.freebsd.org> Resent-Message-ID: <200806161000.m5GA09TV017369@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 124637 >Category: ports >Synopsis: [patch] games/powwow up to 1.2.13, sgtty -> termios conversion >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jun 16 10:00:09 UTC 2008 >Closed-Date: >Last-Modified: >Originator: Alex Kozlov >Release: FreeBSD 6.3 >Organization: private >Environment: >Description: - update to 1.2.13 - sgtty -> termios conversion >How-To-Repeat: >Fix: Patch attached with submission follows: Index: games/powwow/files/patch-follow.c @@ -1,11 +1,65 @@ ---- follow.c.orig Sat Oct 14 00:12:28 2006 -+++ follow.c Sat Oct 14 00:12:43 2006 -@@ -96,7 +96,7 @@ - ioctl(0, TIOCGLTC, <csave); - ttyb = ttybsave; - ttyb.sg_flags = (ttyb.sg_flags|O_CBREAK) & ~O_ECHO; -- ioctl(tty_read_fd, TIOCSETP, &ttyb); -+ ioctl(0, TIOCSETP, &ttyb); - ltc = ltcsave; - ltc.t_suspc = -1; +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, <c); + #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, <csave); + #else /* not USE_SGTTY */ ++#if POSIX ++ tcsetattr(0, TCSANOW, &ttybsave); ++#else + ioctl(0, TCSETS, &ttybsave); ++#endif + #endif /* USE_SGTTY */ + } + Index: games/powwow/files/patch-ptr.c @@ -0,0 +1,17 @@ +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) + { Index: games/powwow/files/patch-ptr.h @@ -0,0 +1,10 @@ +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_ */ Index: games/powwow/files/patch-tty.c @@ -0,0 +1,88 @@ +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, <c); + #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, <csave); + #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 */ + } Index: games/powwow/Makefile @@ -6,7 +6,7 @@ # PORTNAME= powwow -PORTVERSION= 1.2.10 +PORTVERSION= 1.2.13 CATEGORIES= games MASTER_SITES= http://hoopajoo.net/static/projects/ \ ftp://ftp.wilbury.sk/pub/FreeBSD/local/distfiles/ @@ -15,19 +15,15 @@ COMMENT= Client to play MUDs GNU_CONFIGURE= yes -CONFIGURE_ARGS+= --enable-bsd MAN6= powwow.6 .include <bsd.port.pre.mk> -.if ${OSVERSION} >= 800034 -BROKEN= does not compile -.endif - 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 do-install: ${INSTALL_PROGRAM} ${WRKSRC}/powwow ${PREFIX}/bin Index: games/powwow/distinfo @@ -1,3 +1,3 @@ -MD5 (powwow-1.2.10.tar.gz) = f8d948d5a0cb5fd1e74d05ad1420441a -SHA256 (powwow-1.2.10.tar.gz) = fd556e876529ac5b1c8be915b9750a45ff5cde8ec88e66befe88a56844f9799b -SIZE (powwow-1.2.10.tar.gz) = 257811 +MD5 (powwow-1.2.13.tar.gz) = 42240a569c7fba837aa140f084de55ed +SHA256 (powwow-1.2.13.tar.gz) = be22d1d8f12b89d70375e1657eb7d746a338d606a4afe29f8fa5b423bf7415ef +SIZE (powwow-1.2.13.tar.gz) = 274569 >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200806160952.m5G9q2Ek037423>