diff options
author | Juergen Lock <nox@FreeBSD.org> | 2007-03-23 23:02:33 +0000 |
---|---|---|
committer | Juergen Lock <nox@FreeBSD.org> | 2007-03-23 23:02:33 +0000 |
commit | 805f53212b166733a8af59ed5501fc22efded809 (patch) | |
tree | 0d74e8d7b34041f204caf0250ffdee789f79e988 | |
parent | bb3f53a51d553edf02fd17ff982dd59ae7f37422 (diff) | |
download | ports-805f53212b166733a8af59ed5501fc22efded809.tar.gz ports-805f53212b166733a8af59ed5501fc22efded809.zip |
Convert freebsd-games to use termios.h instead of sgtty.h
PR: ports/110731
Submitted by: Alex Kozlov <spam@rm-rf.kiev.ua>
Approved by: miwi (mentor)
Notes
Notes:
svn path=/head/; revision=188142
70 files changed, 1098 insertions, 444 deletions
diff --git a/games/bsdgames/files/patch-adventure::crc.c b/games/bsdgames/files/patch-adventure::crc.c index dfca63e6ab53..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-adventure::crc.c +++ b/games/bsdgames/files/patch-adventure::crc.c @@ -1,11 +0,0 @@ ---- adventure/crc.c.bak Sat Feb 23 01:59:45 2002 -+++ adventure/crc.c Wed Sep 29 03:29:37 2004 -@@ -120,7 +120,7 @@ - - /* Process nr bytes at a time; ptr points to them */ - u_long --crc(const char *ptr, size_t nr) -+crc(const char *ptr, ssize_t nr) - { - int i; - const char *p; diff --git a/games/bsdgames/files/patch-adventure::hdr.h b/games/bsdgames/files/patch-adventure::hdr.h index 02344c9191b4..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-adventure::hdr.h +++ b/games/bsdgames/files/patch-adventure::hdr.h @@ -1,11 +0,0 @@ ---- adventure/hdr.h.bak Mon Nov 10 15:46:52 2003 -+++ adventure/hdr.h Wed Sep 29 03:30:55 2004 -@@ -167,7 +167,7 @@ - void checkhints (void); - void ciao (void); - extern gid_t egid; --u_long crc (const char *ptr, size_t nr); -+u_long crc (const char *ptr, ssize_t nr); - void crc_start (void); - int dark (void); - void datime (int *d, int *t); diff --git a/games/bsdgames/files/patch-adventure_crc.c b/games/bsdgames/files/patch-adventure_crc.c new file mode 100644 index 000000000000..dfca63e6ab53 --- /dev/null +++ b/games/bsdgames/files/patch-adventure_crc.c @@ -0,0 +1,11 @@ +--- adventure/crc.c.bak Sat Feb 23 01:59:45 2002 ++++ adventure/crc.c Wed Sep 29 03:29:37 2004 +@@ -120,7 +120,7 @@ + + /* Process nr bytes at a time; ptr points to them */ + u_long +-crc(const char *ptr, size_t nr) ++crc(const char *ptr, ssize_t nr) + { + int i; + const char *p; diff --git a/games/bsdgames/files/patch-adventure_hdr.h b/games/bsdgames/files/patch-adventure_hdr.h new file mode 100644 index 000000000000..02344c9191b4 --- /dev/null +++ b/games/bsdgames/files/patch-adventure_hdr.h @@ -0,0 +1,11 @@ +--- adventure/hdr.h.bak Mon Nov 10 15:46:52 2003 ++++ adventure/hdr.h Wed Sep 29 03:30:55 2004 +@@ -167,7 +167,7 @@ + void checkhints (void); + void ciao (void); + extern gid_t egid; +-u_long crc (const char *ptr, size_t nr); ++u_long crc (const char *ptr, ssize_t nr); + void crc_start (void); + int dark (void); + void datime (int *d, int *t); diff --git a/games/bsdgames/files/patch-atc_Makefile b/games/bsdgames/files/patch-atc_Makefile new file mode 100644 index 000000000000..b225c610b586 --- /dev/null +++ b/games/bsdgames/files/patch-atc_Makefile @@ -0,0 +1,10 @@ +Index: atc/Makefile +@@ -2,7 +2,7 @@ + # $FreeBSD$ + + PROG= atc +-CFLAGS+=-DBSD -I${.CURDIR} -I. ++CFLAGS+=-DPOSIX -I${.CURDIR} -I. + SRCS= extern.c grammar.y graphics.c input.c lex.l list.c log.c \ + main.c tunable.c update.c y.tab.h + MAN= atc.6 diff --git a/games/bsdgames/files/patch-atc_include.h b/games/bsdgames/files/patch-atc_include.h new file mode 100644 index 000000000000..e35e06466e45 --- /dev/null +++ b/games/bsdgames/files/patch-atc_include.h @@ -0,0 +1,35 @@ +Index: atc/include.h +@@ -63,6 +63,14 @@ + #include <sys/utsname.h> + #endif + ++#ifdef POSIX ++#include <termios.h> ++#include <fcntl.h> ++#include <unistd.h> ++#include <string.h> ++#include <sys/utsname.h> ++#endif ++ + #include <signal.h> + #include <math.h> + +@@ -76,6 +84,18 @@ + #define srandom srand + #define random rand + #define sgttyb termio ++#define sg_erase c_cc[VERASE] ++#define sg_kill c_cc[VKILL] ++#endif ++ ++#ifdef POSIX ++#define index strchr ++#define rindex strrchr ++#define bcopy(a,b,c) memcpy((b), (a), (c)) ++#define bzero(a,b) memset((a), '\0', (b)) ++#define srandom srand ++#define random rand ++#define sgttyb termios + #define sg_erase c_cc[2] + #define sg_kill c_cc[3] + #endif diff --git a/games/bsdgames/files/patch-atc_input.c b/games/bsdgames/files/patch-atc_input.c new file mode 100644 index 000000000000..7cafb6d74459 --- /dev/null +++ b/games/bsdgames/files/patch-atc_input.c @@ -0,0 +1,23 @@ +Index: atc/input.c +@@ -323,6 +323,10 @@ + int aval; + aval = alarm(0); + #endif ++#ifdef POSIX ++ int aval; ++ aval = alarm(0); ++#endif + if (fork() == 0) /* child */ + { + char *shell, *base; +@@ -358,6 +362,10 @@ + #endif + #ifdef SYSV + ioctl(fileno(stdin), TCSETAW, &tty_new); ++ alarm(aval); ++#endif ++#ifdef POSIX ++ tcsetattr(fileno(stdin), TCSANOW, &tty_new); + alarm(aval); + #endif + } diff --git a/games/bsdgames/files/patch-atc_main.c b/games/bsdgames/files/patch-atc_main.c new file mode 100644 index 000000000000..3592011afea8 --- /dev/null +++ b/games/bsdgames/files/patch-atc_main.c @@ -0,0 +1,47 @@ +Index: atc/main.c +@@ -173,6 +173,15 @@ + ioctl(fileno(stdin), TCSETAW, &tty_new); + #endif + ++#ifdef POSIX ++ tcgetattr(fileno(stdin), &tty_start); ++ bcopy(&tty_start, &tty_new, sizeof(tty_new)); ++ tty_new.c_lflag &= ~ICANON; ++ tty_new.c_lflag &= ~ECHO; ++ tty_new.c_cc[VMIN] = 1; ++ tty_new.c_cc[VTIME] = 0; ++ tcsetattr(fileno(stdin), TCSANOW, &tty_new); ++#endif + signal(SIGALRM, update); + + #ifdef BSD +@@ -185,6 +194,9 @@ + #ifdef SYSV + alarm(sp->update_secs); + #endif ++#ifdef POSIX ++ alarm(sp->update_secs); ++#endif + + for (;;) { + if (getcommand() != 1) +@@ -198,6 +210,9 @@ + #ifdef SYSV + alarm(0); + #endif ++#ifdef POSIX ++ alarm(0); ++#endif + + update(); + +@@ -209,6 +224,9 @@ + setitimer(ITIMER_REAL, &itv, NULL); + #endif + #ifdef SYSV ++ alarm(sp->update_secs); ++#endif ++#ifdef POSIX + alarm(sp->update_secs); + #endif + } diff --git a/games/bsdgames/files/patch-backgammon_backgammon_main.c b/games/bsdgames/files/patch-backgammon_backgammon_main.c index c3d4e04c2f4d..840d4ba48057 100644 --- a/games/bsdgames/files/patch-backgammon_backgammon_main.c +++ b/games/bsdgames/files/patch-backgammon_backgammon_main.c @@ -1,11 +1,29 @@ ---- backgammon/backgammon/main.c.orig Tue Nov 11 10:46:54 2003 -+++ backgammon/backgammon/main.c Sun Apr 16 21:21:01 2006 -@@ -53,6 +53,8 @@ - #include <signal.h> - #include "back.h" - -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) -+ - #define MVPAUSE 5 /* time to sleep when stuck */ - #define MAXUSERS 35 /* maximum number of users */ +Index: backgammon/backgammon/main.c +@@ -113,13 +111,13 @@ + signal (SIGINT,getout); /* trap interrupts */ + if (gtty (0,&tty) == -1) /* get old tty mode */ + errexit ("backgammon(gtty)"); +- old = tty.sg_flags; ++ old = tty.c_lflag; + #ifdef V7 +- raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */ ++ raw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */ + #else + raw = ((noech = old & ~ECHO) | RAW); /* set up modes */ + #endif +- ospeed = tty.sg_ospeed; /* for termlib */ ++ ospeed = cfgetospeed(&tty); /* for termlib */ + /* get terminal + * capabilities, and +@@ -135,8 +133,8 @@ + getarg (argc, argv); + args[acnt] = NULL; + if (tflag) { /* clear screen */ +- noech &= ~(CRMOD|XTABS); +- raw &= ~(CRMOD|XTABS); ++ noech &= ~(ICRNL|OXTABS); ++ raw &= ~(ICRNL|OXTABS); + clear(); + } + fixtty (raw); /* go into raw mode */ diff --git a/games/bsdgames/files/patch-backgammon_common__source_back.h b/games/bsdgames/files/patch-backgammon_common__source_back.h new file mode 100644 index 000000000000..2542f462c63e --- /dev/null +++ b/games/bsdgames/files/patch-backgammon_common__source_back.h @@ -0,0 +1,25 @@ +Index: backgammon/common_source/back.h +@@ -33,7 +33,13 @@ + * @(#)back.h 8.1 (Berkeley) 5/31/93 + */ + +-#include <sgtty.h> ++#include <termios.h> ++ ++#define sg_erase c_cc[2] ++#define sg_kill c_cc[3] ++ ++#define gtty(_a,_b) tcgetattr(_a,_b) ++#define stty(_a,_b) tcsetattr(_a,TCSANOW,_b) + + #define rnum(r) (random()%r) + #define D0 dice[0] +@@ -114,7 +120,7 @@ + extern const char *const *Colorptr; /* color of current player, capitalized */ + extern int colen; /* length of color of current player */ + +-extern struct sgttyb tty; /* tty information buffer */ ++extern struct termios tty; /* tty information buffer */ + extern int old; /* original tty status */ + extern int noech; /* original tty status without echo */ + extern int raw; /* raw tty status, no echo */ diff --git a/games/bsdgames/files/patch-backgammon_common__source_subs.c b/games/bsdgames/files/patch-backgammon_common__source_subs.c index 54fe4a023ecb..646faa72d625 100644 --- a/games/bsdgames/files/patch-backgammon_common__source_subs.c +++ b/games/bsdgames/files/patch-backgammon_common__source_subs.c @@ -1,11 +1,10 @@ ---- backgammon/common_source/subs.c.orig Mon Apr 22 23:44:18 2002 -+++ backgammon/common_source/subs.c Sun Apr 16 21:27:43 2006 -@@ -44,6 +44,8 @@ - #include <string.h> - #include "back.h" - -+#define stty(_a,_b) ioctl(_a,TIOCSETP,_b) -+ - int buffnum; - char outbuff[BUFSIZ]; - +Index: backgammon/common_source/subs.c +@@ -420,7 +418,7 @@ + if (tflag) + newpos(); + buflush(); +- tty.sg_flags = mode; ++ tty.c_lflag = mode; + if (stty (0,&tty) < 0) + errexit("fixtty"); + } diff --git a/games/bsdgames/files/patch-backgammon_teachgammon_teach.c b/games/bsdgames/files/patch-backgammon_teachgammon_teach.c index cc5ee8c2ff46..8b1ae587e9e8 100644 --- a/games/bsdgames/files/patch-backgammon_teachgammon_teach.c +++ b/games/bsdgames/files/patch-backgammon_teachgammon_teach.c @@ -1,11 +1,25 @@ ---- backgammon/teachgammon/teach.c.orig Sat Feb 2 20:37:20 2002 -+++ backgammon/teachgammon/teach.c Sun Apr 16 21:22:11 2006 -@@ -52,6 +52,8 @@ - #include <signal.h> - #include "back.h" - -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) -+ - extern char *hello[]; - extern char *list[]; - extern char *intro1[]; +Index: backgammon/teachgammon/teach.c +@@ -94,18 +92,18 @@ + signal (SIGINT,getout); + if (gtty (0,&tty) == -1) /* get old tty mode */ + errexit ("teachgammon(gtty)"); +- old = tty.sg_flags; ++ old = tty.c_lflag; + #ifdef V7 +- raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */ ++ raw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */ + #else + raw = ((noech = old & ~ECHO) | RAW); /* set up modes */ + #endif +- ospeed = tty.sg_ospeed; /* for termlib */ ++ ospeed = cfgetospeed(&tty); /* for termlib */ + tflag = getcaps (getenv ("TERM")); + getarg (argc, argv); + if (tflag) { +- noech &= ~(CRMOD|XTABS); +- raw &= ~(CRMOD|XTABS); ++ noech &= ~(ICRNL|OXTABS); ++ raw &= ~(ICRNL|OXTABS); + clear(); + } + text (hello); diff --git a/games/bsdgames/files/patch-battlestar::init.c b/games/bsdgames/files/patch-battlestar::init.c index 077107c3e5aa..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-battlestar::init.c +++ b/games/bsdgames/files/patch-battlestar::init.c @@ -1,11 +0,0 @@ ---- battlestar/init.c.old Mon Dec 15 17:48:41 2003 -+++ battlestar/init.c Mon Dec 15 17:48:54 2003 -@@ -62,7 +62,7 @@ - puts("Admiral D.W. Riggle\n"); - srandomdev(); - getutmp(uname); -- if (startup) -+ if (startup == NULL) - location = dayfile; - wiz = wizard(uname); - wordinit(); diff --git a/games/bsdgames/files/patch-battlestar_init.c b/games/bsdgames/files/patch-battlestar_init.c new file mode 100644 index 000000000000..077107c3e5aa --- /dev/null +++ b/games/bsdgames/files/patch-battlestar_init.c @@ -0,0 +1,11 @@ +--- battlestar/init.c.old Mon Dec 15 17:48:41 2003 ++++ battlestar/init.c Mon Dec 15 17:48:54 2003 +@@ -62,7 +62,7 @@ + puts("Admiral D.W. Riggle\n"); + srandomdev(); + getutmp(uname); +- if (startup) ++ if (startup == NULL) + location = dayfile; + wiz = wizard(uname); + wordinit(); diff --git a/games/bsdgames/files/patch-hack::Makefile b/games/bsdgames/files/patch-hack::Makefile index eaa8d43922d1..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-hack::Makefile +++ b/games/bsdgames/files/patch-hack::Makefile @@ -1,13 +0,0 @@ -$FreeBSD$ - ---- hack/Makefile.orig Thu Nov 20 11:06:45 2003 -+++ hack/Makefile Thu Nov 20 11:13:27 2003 -@@ -18,6 +18,8 @@ - DPADD= ${LIBTERMCAP} ${LIBCOMPAT} - LDADD= -ltermcap -lcompat - CFLAGS+= -fwritable-strings -I${.CURDIR} -I. -+BINGRP= games -+BINMODE=2555 - FILES= rumors help hh data - FILESMODE_rumors= 440 - FILESGRP= ${BINGRP} diff --git a/games/bsdgames/files/patch-hack::hack.termcap.c b/games/bsdgames/files/patch-hack::hack.termcap.c index de8fd532021c..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-hack::hack.termcap.c +++ b/games/bsdgames/files/patch-hack::hack.termcap.c @@ -1,13 +0,0 @@ ---- hack/hack.termcap.c.orig Sat Mar 6 22:18:53 2004 -+++ hack/hack.termcap.c Thu Mar 11 18:42:47 2004 -@@ -35,7 +35,8 @@ - flags.nonull = 1; - if(pc = tgetstr("pc", &tbufptr)) - PC = *pc; -- if(!(BC = tgetstr("bc", &tbufptr))) { -+ if(!(BC = tgetstr("bc", &tbufptr)) -+ &&!(BC = tgetstr("le", &tbufptr))) { - if(!tgetflag("bs")) - error("Terminal must backspace."); - BC = tbufptr; - diff --git a/games/bsdgames/files/patch-hack::hack.unix.c b/games/bsdgames/files/patch-hack::hack.unix.c index 8143edad035c..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-hack::hack.unix.c +++ b/games/bsdgames/files/patch-hack::hack.unix.c @@ -1,13 +0,0 @@ -$FreeBSD$ - ---- hack/hack.unix.c.orig Thu Nov 20 10:17:36 2003 -+++ hack/hack.unix.c Thu Nov 20 10:18:09 2003 -@@ -86,7 +86,7 @@ - /* old version - for people short of space */ - char *np; - -- name = "/usr/games/hide/hack"; -+ name = "%%PREFIX%%/bin/hack"; - if(stat(name, &hbuf)) - error("Cannot get status of %s.", - (np = rindex(name, '/')) ? np+1 : name); diff --git a/games/bsdgames/files/patch-hack_Makefile b/games/bsdgames/files/patch-hack_Makefile new file mode 100644 index 000000000000..384893572eb5 --- /dev/null +++ b/games/bsdgames/files/patch-hack_Makefile @@ -0,0 +1,12 @@ +Index: hack/Makefile +@@ -17,7 +17,9 @@ + MAN= hack.6 + DPADD= ${LIBTERMCAP} ${LIBCOMPAT} + LDADD= -ltermcap -lcompat +-CFLAGS+= -fwritable-strings -I${.CURDIR} -I. ++CFLAGS+= -DPOSIX -I${.CURDIR} -I. ++BINGRP=games ++BINMODE=2555 + FILES= rumors help hh data + FILESMODE_rumors= 440 + FILESGRP= ${BINGRP} diff --git a/games/bsdgames/files/patch-hack_config.h b/games/bsdgames/files/patch-hack_config.h new file mode 100644 index 000000000000..cc7fd6cf95b2 --- /dev/null +++ b/games/bsdgames/files/patch-hack_config.h @@ -0,0 +1,9 @@ +Index: hack/config.h +@@ -22,7 +22,6 @@ + * Also, the code for suspend and various ioctls is only given for BSD4.2 + * (I do not have access to a SYSV system.) + */ +-#define BSD /* delete this line on System V */ + + /* #define STUPID */ /* avoid some complicated expressions if + your C compiler chokes on them */ diff --git a/games/bsdgames/files/patch-hack_hack.ioctl.c b/games/bsdgames/files/patch-hack_hack.ioctl.c new file mode 100644 index 000000000000..cd899364bed0 --- /dev/null +++ b/games/bsdgames/files/patch-hack_hack.ioctl.c @@ -0,0 +1,29 @@ +Index: hack/hack.ioctl.c +@@ -13,6 +13,9 @@ + #ifdef BSD + #include <sgtty.h> + struct ltchars ltchars, ltchars0; ++#elif POSIX ++#include <termios.h> ++struct termios termio; + #else + #include <termio.h> /* also includes part of <sgtty.h> */ + struct termio termio; +@@ -22,6 +25,8 @@ + #ifdef BSD + (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars); + (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0); ++#elif POSIX ++ tcgetattr(fileno(stdin), &termio); + #else + (void) ioctl(fileno(stdin), (int) TCGETA, &termio); + #endif /* BSD */ +@@ -30,6 +35,8 @@ + setioctls() { + #ifdef BSD + (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars); ++#elif POSIX ++ tcsetattr(fileno(stdin), TCSANOW, &termio); + #else + (void) ioctl(fileno(stdin), (int) TCSETA, &termio); + #endif /* BSD */ diff --git a/games/bsdgames/files/patch-hack_hack.pager.c b/games/bsdgames/files/patch-hack_hack.pager.c new file mode 100644 index 000000000000..3a9df40b839e --- /dev/null +++ b/games/bsdgames/files/patch-hack_hack.pager.c @@ -0,0 +1,10 @@ +Index: hack/hack.pager.c +@@ -367,6 +367,8 @@ + #else + + #ifdef BSD ++#include <sys/wait.h> ++#elif POSIX + #include <sys/wait.h> + #else + #include <wait.h> diff --git a/games/bsdgames/files/patch-hack_hack.termcap.c b/games/bsdgames/files/patch-hack_hack.termcap.c new file mode 100644 index 000000000000..de8fd532021c --- /dev/null +++ b/games/bsdgames/files/patch-hack_hack.termcap.c @@ -0,0 +1,13 @@ +--- hack/hack.termcap.c.orig Sat Mar 6 22:18:53 2004 ++++ hack/hack.termcap.c Thu Mar 11 18:42:47 2004 +@@ -35,7 +35,8 @@ + flags.nonull = 1; + if(pc = tgetstr("pc", &tbufptr)) + PC = *pc; +- if(!(BC = tgetstr("bc", &tbufptr))) { ++ if(!(BC = tgetstr("bc", &tbufptr)) ++ &&!(BC = tgetstr("le", &tbufptr))) { + if(!tgetflag("bs")) + error("Terminal must backspace."); + BC = tbufptr; + diff --git a/games/bsdgames/files/patch-hack_hack.tty.c b/games/bsdgames/files/patch-hack_hack.tty.c index 03cad9a090dc..07a126779f6a 100644 --- a/games/bsdgames/files/patch-hack_hack.tty.c +++ b/games/bsdgames/files/patch-hack_hack.tty.c @@ -1,13 +1,42 @@ ---- hack/hack.tty.c Wed Jun 23 21:36:26 2004 -+++ hack/hack.tty.c Wed Jun 23 21:50:12 2004 -@@ -95,8 +95,8 @@ - #define CBRKMASK CBREAK - #define CBRKON /* empty */ - #define OSPEED(x) (x).sg_ospeed --#define GTTY(x) (gtty(0, x)) --#define STTY(x) (stty(0, x)) -+#define GTTY(x) (ioctl(0, TIOCGETP, x)) -+#define STTY(x) (ioctl(0, TIOCSETP, x)) +Index: hack/hack.tty.c +@@ -53,6 +53,7 @@ + */ + #ifdef BSD + #define V7 ++#elif POSIX + #else + #define USG + #endif /* BSD */ +@@ -82,6 +83,21 @@ + #define GTTY(x) (ioctl(0, TCGETA, x)) + #define STTY(x) (ioctl(0, TCSETA, x)) /* TCSETAF? TCSETAW? */ - #endif /* USG */ ++#elif POSIX ++#include <termios.h> ++#define termstruct termios ++#define kill_sym c_cc[VKILL] ++#define erase_sym c_cc[VERASE] ++#define EXTABS OXTABS ++#define tabflgs c_oflag ++#define echoflgs c_lflag ++#define cbrkflgs c_lflag ++#define CBRKMASK ICANON ++#define CBRKON ! /* reverse condition */ ++#define OSPEED(x) cfgetospeed(x) ++#define GTTY(x) tcgetattr(fileno(stdin),x) ++#define STTY(x) tcsetattr(fileno(stdin),TCSANOW,x) /* TCSETAF? TCSETAW? */ ++ + #else /* V7 */ + #include <sgtty.h> +@@ -169,6 +185,10 @@ + /* be satisfied with one character; no timeout */ + curttyb.c_cc[VMIN] = 1; /* was VEOF */ + curttyb.c_cc[VTIME] = 0; /* was VEOL */ ++#elif POSIX ++ /* be satisfied with one character; no timeout */ ++ curttyb.c_cc[VMIN] = 1; /* was VEOF */ ++ curttyb.c_cc[VTIME] = 0; /* was VEOL */ + #endif /* USG */ + change++; + } diff --git a/games/bsdgames/files/patch-hack_hack.unix.c b/games/bsdgames/files/patch-hack_hack.unix.c new file mode 100644 index 000000000000..ec4e5eab205d --- /dev/null +++ b/games/bsdgames/files/patch-hack_hack.unix.c @@ -0,0 +1,13 @@ +$FreeBSD: /tmp/pcvs/ports/games/bsdgames/files/Attic/patch-hack_hack.unix.c,v 1.1 2007-03-23 23:02:33 nox Exp $ + +--- hack/hack.unix.c.orig Thu Nov 20 10:17:36 2003 ++++ hack/hack.unix.c Thu Nov 20 10:18:09 2003 +@@ -86,7 +86,7 @@ + /* old version - for people short of space */ + char *np; + +- name = "/usr/games/hide/hack"; ++ name = "%%PREFIX%%/bin/hack"; + if(stat(name, &hbuf)) + error("Cannot get status of %s.", + (np = rindex(name, '/')) ? np+1 : name); diff --git a/games/bsdgames/files/patch-larn::diag.c b/games/bsdgames/files/patch-larn::diag.c index f3cf3d0a5c8b..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-larn::diag.c +++ b/games/bsdgames/files/patch-larn::diag.c @@ -1,31 +0,0 @@ -$FreeBSD$ - ---- larn/diag.c 17 Jun 2003 04:25:24 -0000 1.2 -+++ larn/diag.c 21 Jun 2004 02:28:34 -0000 1.3 -@@ -210,7 +210,7 @@ - if (beenhere[k]) - lrfill((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX); - -- lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint(); -+ lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint_x(); - level = c[CAVELEVEL] = lgetc(); - playerx = lgetc(); playery = lgetc(); - lrfill((char*)iven,26); lrfill((char*)ivenarg,26*sizeof(short)); -@@ -241,7 +241,7 @@ - } - - time(&zzz); -- initialtime = zzz-lrint(); -+ initialtime = zzz-lrint_x(); - fstat(fd,&filetimes); /* get the creation and modification time of file */ - lrfill((char*)&zzz,sizeof(long)); zzz += 6; - if (filetimes.st_ctime > zzz) fsorry(); /* file create time */ -@@ -249,7 +249,7 @@ - if (c[HP]<0) { died(284); return; } /* died a post mortem death */ - - oldx = oldy = 0; -- i = lrint(); /* inode # */ -+ i = lrint_x(); /* inode # */ - if (i && (filetimes.st_ino!=i)) fsorry(); - lrclose(); - if (strcmp(fname,ckpfile) == 0) diff --git a/games/bsdgames/files/patch-larn::header.h b/games/bsdgames/files/patch-larn::header.h index ea58c01c7952..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-larn::header.h +++ b/games/bsdgames/files/patch-larn::header.h @@ -1,13 +0,0 @@ -$FreeBSD$ - ---- larn/header.h 17 Jun 2003 02:49:28 -0000 1.1 -+++ larn/header.h 21 Jun 2004 02:28:34 -0000 1.2 -@@ -359,7 +359,7 @@ - - char *fortune(),*lgetw(),*lgetl(); - char *tmcapcnv(); --long paytaxes(),lgetc(),lrint(); -+long paytaxes(),lgetc(),lrint_x(); - unsigned long readnum(); - - /* macro to create scroll #'s with probability of occurrence */ diff --git a/games/bsdgames/files/patch-larn::io.c b/games/bsdgames/files/patch-larn::io.c index b36c953d59bd..e69de29bb2d1 100644 --- a/games/bsdgames/files/patch-larn::io.c +++ b/games/bsdgames/files/patch-larn::io.c @@ -1,39 +0,0 @@ ---- larn/io.c.orig Thu May 9 06:39:10 2002 -+++ larn/io.c Sun Apr 16 20:40:41 2006 -@@ -24,7 +24,7 @@ - * FILE INPUT ROUTINES - * - * long lgetc() read one character from input buffer -- * long lrint() read one integer from input buffer -+ * long lrint_x() read one integer from input buffer - * lrfill(address,number) put input bytes into a buffer - * char *lgetw() get a whitespace ended word from input - * char *lgetl() get a \n or EOF ended line from input -@@ -75,6 +75,9 @@ - #define CBREAK RAW /* V7 has no CBREAK */ - #endif - -+#define stty(_a,_b) ioctl(_a,TIOCSETP,_b) -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) -+ - #define doraw(_a) (_a.sg_flags |= CBREAK,_a.sg_flags &= ~ECHO) - #define unraw(_a) (_a.sg_flags &= ~CBREAK,_a.sg_flags |= ECHO) - #include <sgtty.h> -@@ -345,7 +348,7 @@ - } - - /* -- * long lrint() Read one integer from input buffer -+ * long lrint_x() Read one integer from input buffer - * - * +---------+---------+---------+---------+ - * | high | | | low | -@@ -357,7 +360,7 @@ - * The save order is low order first, to high order (4 bytes total) - * Returns the int read - */ --long lrint() -+long lrint_x() - { - unsigned long i; - i = 255 & lgetc(); i |= (255 & lgetc()) << 8; diff --git a/games/bsdgames/files/patch-larn_Makefile b/games/bsdgames/files/patch-larn_Makefile new file mode 100644 index 000000000000..3671991924cb --- /dev/null +++ b/games/bsdgames/files/patch-larn_Makefile @@ -0,0 +1,10 @@ +Index: larn/Makefile +@@ -54,7 +54,7 @@ + + PROG= larn + MAN= larn.6 +-CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -fwritable-strings -DNOVARARGS ++CFLAGS+=-DPOSIX -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -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 diff --git a/games/bsdgames/files/patch-larn_diag.c b/games/bsdgames/files/patch-larn_diag.c new file mode 100644 index 000000000000..0129c5e747fe --- /dev/null +++ b/games/bsdgames/files/patch-larn_diag.c @@ -0,0 +1,31 @@ +$FreeBSD: /tmp/pcvs/ports/games/bsdgames/files/Attic/patch-larn_diag.c,v 1.1 2007-03-23 23:02:33 nox Exp $ + +--- larn/diag.c 17 Jun 2003 04:25:24 -0000 1.2 ++++ larn/diag.c 21 Jun 2004 02:28:34 -0000 1.3 +@@ -210,7 +210,7 @@ + if (beenhere[k]) + lrfill((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX); + +- lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint(); ++ lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint_x(); + level = c[CAVELEVEL] = lgetc(); + playerx = lgetc(); playery = lgetc(); + lrfill((char*)iven,26); lrfill((char*)ivenarg,26*sizeof(short)); +@@ -241,7 +241,7 @@ + } + + time(&zzz); +- initialtime = zzz-lrint(); ++ initialtime = zzz-lrint_x(); + fstat(fd,&filetimes); /* get the creation and modification time of file */ + lrfill((char*)&zzz,sizeof(long)); zzz += 6; + if (filetimes.st_ctime > zzz) fsorry(); /* file create time */ +@@ -249,7 +249,7 @@ + if (c[HP]<0) { died(284); return; } /* died a post mortem death */ + + oldx = oldy = 0; +- i = lrint(); /* inode # */ ++ i = lrint_x(); /* inode # */ + if (i && (filetimes.st_ino!=i)) fsorry(); + lrclose(); + if (strcmp(fname,ckpfile) == 0) diff --git a/games/bsdgames/files/patch-larn_header.h b/games/bsdgames/files/patch-larn_header.h new file mode 100644 index 000000000000..96f43651a9c7 --- /dev/null +++ b/games/bsdgames/files/patch-larn_header.h @@ -0,0 +1,18 @@ +Index: larn/header.h +@@ -326,7 +326,6 @@ + #define DEMONLORD 57 + #define DEMONPRINCE 64 + +-#define NULL 0 + #define BUFBIG 4096 /* size of the output buffer */ + #define MAXIBUF 4096 /* size of the input buffer */ + #define LOGNAMESIZE 40 /* max size of the players name */ +@@ -359,7 +359,7 @@ + + char *fortune(),*lgetw(),*lgetl(); + char *tmcapcnv(); +-long paytaxes(),lgetc(),lrint(); ++long paytaxes(),lgetc(),lrint_x(); + unsigned long readnum(); + + /* macro to create scroll #'s with probability of occurrence */ diff --git a/games/bsdgames/files/patch-larn_io.c b/games/bsdgames/files/patch-larn_io.c new file mode 100644 index 000000000000..bbbb35860082 --- /dev/null +++ b/games/bsdgames/files/patch-larn_io.c @@ -0,0 +1,46 @@ +Index: larn/io.c +@@ -24,7 +24,7 @@ + * FILE INPUT ROUTINES + * + * long lgetc() read one character from input buffer +- * long lrint() read one integer from input buffer ++ * long lrint_x() read one integer from input buffer + * lrfill(address,number) put input bytes into a buffer + * char *lgetw() get a whitespace ended word from input + * char *lgetl() get a \n or EOF ended line from input +@@ -69,6 +69,17 @@ + _a.c_cc[VMIN]=1;_a.c_cc[VTIME]=1;_a.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL) + #define unraw(_a) _a.c_cc[VMIN]=saveeof;_a.c_cc[VTIME]=saveeol;_a.c_lflag |= ICANON|ECHO|ECHOE|ECHOK|ECHONL + ++#elif POSIX ++#include <termios.h> ++#define sgttyb termios ++#define gtty(_a,_b) tcgetattr(_a,_b) ++#define stty(_a,_b) tcsetattr(_a,TCSANOW,_b) ++static int rawflg = 0; ++static char saveeof,saveeol; ++#define doraw(_a) if(!rawflg){++rawflg;saveeof=_a.c_cc[VMIN];saveeol=_a.c_cc[VTIME];}\ ++ _a.c_cc[VMIN]=1;_a.c_cc[VTIME]=1;_a.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL) ++#define unraw(_a) _a.c_cc[VMIN]=saveeof;_a.c_cc[VTIME]=saveeol;_a.c_lflag |= ICANON|ECHO|ECHOE|ECHOK|ECHONL ++ + #else /* not SYSV */ + + #ifndef BSD +@@ -345,7 +356,7 @@ + } + + /* +- * long lrint() Read one integer from input buffer ++ * long lrint_x() Read one integer from input buffer + * + * +---------+---------+---------+---------+ + * | high | | | low | +@@ -357,7 +368,7 @@ + * The save order is low order first, to high order (4 bytes total) + * Returns the int read + */ +-long lrint() ++long lrint_x() + { + unsigned long i; + i = 255 & lgetc(); i |= (255 & lgetc()) << 8; diff --git a/games/bsdgames/files/patch-snake_snake_move.c b/games/bsdgames/files/patch-snake_snake_move.c index 225ef0c151bf..03f96cdc9885 100644 --- a/games/bsdgames/files/patch-snake_snake_move.c +++ b/games/bsdgames/files/patch-snake_snake_move.c @@ -1,12 +1,24 @@ ---- snake/snake/move.c.orig Wed May 29 02:54:00 2002 -+++ snake/snake/move.c Sun Apr 16 21:04:37 2006 -@@ -103,6 +103,9 @@ +Index: snake/snake/move.c +@@ -677,10 +674,10 @@ - #include "snake.h" + gtty(0, &orig); + new=orig; +- new.sg_flags &= ~(ECHO|CRMOD|ALLDELAY|XTABS); +- new.sg_flags |= CBREAK; ++ new.c_lflag &= ~(ECHO|ICRNL|OXTABS); ++ new.c_lflag &= ~ICANON; + signal(SIGINT,stop); +- ospeed = orig.sg_ospeed; ++ ospeed = cfgetospeed(&orig); + #ifdef TIOCGLTC + ioctl(0, TIOCGLTC, &olttyc); + nlttyc = olttyc; +@@ -689,7 +686,7 @@ + #endif + raw(); -+#define stty(_a,_b) ioctl(_a,TIOCSETP,_b) -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) -+ - int CMlength; - int NDlength; - int BSlength; +- if ((orig.sg_flags & XTABS) == XTABS) TA=0; ++ if ((orig.c_lflag & OXTABS) == OXTABS) TA=0; + putpad(KS); + putpad(TI); + point(&cursor,0,LINES-1); diff --git a/games/bsdgames/files/patch-snake_snake_snake.c b/games/bsdgames/files/patch-snake_snake_snake.c index a59d7e434f7b..11c001d38bf6 100644 --- a/games/bsdgames/files/patch-snake_snake_snake.c +++ b/games/bsdgames/files/patch-snake_snake_snake.c @@ -1,11 +1,10 @@ ---- snake/snake/snake.c.orig Tue Nov 11 10:47:06 2003 -+++ snake/snake/snake.c Sun Apr 16 21:04:54 2006 -@@ -68,6 +68,8 @@ - #include "snake.h" - #include "pathnames.h" +Index: snake/snake/snake.c +@@ -183,7 +181,7 @@ + snrand(&money); + snrand(&snake[0]); -+#define stty(_a,_b) ioctl(_a,TIOCSETP,_b) -+ - #define PENALTY 10 /* % penalty for invoking spacewarp */ - - #define EOT '\004' +- if ((orig.sg_ospeed < B9600) || ++ if ((cfgetospeed(&orig) < B9600) || + ((! CM) && (! TA))) fast=0; + for(i=1;i<6;i++) + chase (&snake[i], &snake[i-1]); diff --git a/games/bsdgames/files/patch-snake_snake_snake.h b/games/bsdgames/files/patch-snake_snake_snake.h new file mode 100644 index 000000000000..a89166ac21f3 --- /dev/null +++ b/games/bsdgames/files/patch-snake_snake_snake.h @@ -0,0 +1,25 @@ +Index: snake/snake/snake.h +@@ -38,10 +38,13 @@ + # include <stdio.h> + # include <assert.h> + # include <sys/types.h> +-# include <sgtty.h> ++# include <termios.h> + # include <signal.h> + # include <math.h> + ++#define gtty(_a,_b) tcgetattr(_a,_b) ++#define stty(_a,_b) tcsetattr(_a,TCSANOW,_b) ++ + #define ESC '\033' + + struct tbuffer { +@@ -72,7 +75,7 @@ + int col, line; + }; + struct point cursor; +-struct sgttyb orig, new; ++struct termios orig, new; + #ifdef TIOCLGET + struct ltchars olttyc, nlttyc; + #endif diff --git a/games/bsdgames/files/patch-trek_main.c b/games/bsdgames/files/patch-trek_main.c index 684bc7f0074c..c6880a8a5893 100644 --- a/games/bsdgames/files/patch-trek_main.c +++ b/games/bsdgames/files/patch-trek_main.c @@ -1,11 +1,33 @@ ---- trek/main.c.orig Mon Jun 24 04:29:52 2002 -+++ trek/main.c Sun Apr 16 21:26:44 2006 -@@ -51,6 +51,8 @@ +Index: trek/main.c +@@ -47,10 +47,12 @@ + + # include "trek.h" + # include <stdio.h> +-# include <sgtty.h> ++# include <termios.h> # include <setjmp.h> # include <stdlib.h> -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) ++# define gtty(_a,_b) tcgetattr(_a,_b) + # define PRIO 00 /* default priority */ int Mother = 51 + (51 << 8); +@@ -163,7 +165,7 @@ + int prio; + int ac; + char **av; +- struct sgttyb argp; ++ struct termios argp; + + /* revoke */ + setgid(getgid()); +@@ -176,7 +178,7 @@ + prio = PRIO; + if (gtty(1, &argp) == 0) + { +- if ((argp.sg_ispeed ) < B1200) ++ if ((cfgetispeed(&argp)) < B1200) + Etc.fast++; + } + while (ac > 1 && av[0][0] == '-') diff --git a/games/freebsd-games/files/patch-adventure::crc.c b/games/freebsd-games/files/patch-adventure::crc.c index dfca63e6ab53..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-adventure::crc.c +++ b/games/freebsd-games/files/patch-adventure::crc.c @@ -1,11 +0,0 @@ ---- adventure/crc.c.bak Sat Feb 23 01:59:45 2002 -+++ adventure/crc.c Wed Sep 29 03:29:37 2004 -@@ -120,7 +120,7 @@ - - /* Process nr bytes at a time; ptr points to them */ - u_long --crc(const char *ptr, size_t nr) -+crc(const char *ptr, ssize_t nr) - { - int i; - const char *p; diff --git a/games/freebsd-games/files/patch-adventure::hdr.h b/games/freebsd-games/files/patch-adventure::hdr.h index 02344c9191b4..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-adventure::hdr.h +++ b/games/freebsd-games/files/patch-adventure::hdr.h @@ -1,11 +0,0 @@ ---- adventure/hdr.h.bak Mon Nov 10 15:46:52 2003 -+++ adventure/hdr.h Wed Sep 29 03:30:55 2004 -@@ -167,7 +167,7 @@ - void checkhints (void); - void ciao (void); - extern gid_t egid; --u_long crc (const char *ptr, size_t nr); -+u_long crc (const char *ptr, ssize_t nr); - void crc_start (void); - int dark (void); - void datime (int *d, int *t); diff --git a/games/freebsd-games/files/patch-adventure_crc.c b/games/freebsd-games/files/patch-adventure_crc.c new file mode 100644 index 000000000000..dfca63e6ab53 --- /dev/null +++ b/games/freebsd-games/files/patch-adventure_crc.c @@ -0,0 +1,11 @@ +--- adventure/crc.c.bak Sat Feb 23 01:59:45 2002 ++++ adventure/crc.c Wed Sep 29 03:29:37 2004 +@@ -120,7 +120,7 @@ + + /* Process nr bytes at a time; ptr points to them */ + u_long +-crc(const char *ptr, size_t nr) ++crc(const char *ptr, ssize_t nr) + { + int i; + const char *p; diff --git a/games/freebsd-games/files/patch-adventure_hdr.h b/games/freebsd-games/files/patch-adventure_hdr.h new file mode 100644 index 000000000000..02344c9191b4 --- /dev/null +++ b/games/freebsd-games/files/patch-adventure_hdr.h @@ -0,0 +1,11 @@ +--- adventure/hdr.h.bak Mon Nov 10 15:46:52 2003 ++++ adventure/hdr.h Wed Sep 29 03:30:55 2004 +@@ -167,7 +167,7 @@ + void checkhints (void); + void ciao (void); + extern gid_t egid; +-u_long crc (const char *ptr, size_t nr); ++u_long crc (const char *ptr, ssize_t nr); + void crc_start (void); + int dark (void); + void datime (int *d, int *t); diff --git a/games/freebsd-games/files/patch-atc_Makefile b/games/freebsd-games/files/patch-atc_Makefile new file mode 100644 index 000000000000..b225c610b586 --- /dev/null +++ b/games/freebsd-games/files/patch-atc_Makefile @@ -0,0 +1,10 @@ +Index: atc/Makefile +@@ -2,7 +2,7 @@ + # $FreeBSD$ + + PROG= atc +-CFLAGS+=-DBSD -I${.CURDIR} -I. ++CFLAGS+=-DPOSIX -I${.CURDIR} -I. + SRCS= extern.c grammar.y graphics.c input.c lex.l list.c log.c \ + main.c tunable.c update.c y.tab.h + MAN= atc.6 diff --git a/games/freebsd-games/files/patch-atc_include.h b/games/freebsd-games/files/patch-atc_include.h new file mode 100644 index 000000000000..e35e06466e45 --- /dev/null +++ b/games/freebsd-games/files/patch-atc_include.h @@ -0,0 +1,35 @@ +Index: atc/include.h +@@ -63,6 +63,14 @@ + #include <sys/utsname.h> + #endif + ++#ifdef POSIX ++#include <termios.h> ++#include <fcntl.h> ++#include <unistd.h> ++#include <string.h> ++#include <sys/utsname.h> ++#endif ++ + #include <signal.h> + #include <math.h> + +@@ -76,6 +84,18 @@ + #define srandom srand + #define random rand + #define sgttyb termio ++#define sg_erase c_cc[VERASE] ++#define sg_kill c_cc[VKILL] ++#endif ++ ++#ifdef POSIX ++#define index strchr ++#define rindex strrchr ++#define bcopy(a,b,c) memcpy((b), (a), (c)) ++#define bzero(a,b) memset((a), '\0', (b)) ++#define srandom srand ++#define random rand ++#define sgttyb termios + #define sg_erase c_cc[2] + #define sg_kill c_cc[3] + #endif diff --git a/games/freebsd-games/files/patch-atc_input.c b/games/freebsd-games/files/patch-atc_input.c new file mode 100644 index 000000000000..7cafb6d74459 --- /dev/null +++ b/games/freebsd-games/files/patch-atc_input.c @@ -0,0 +1,23 @@ +Index: atc/input.c +@@ -323,6 +323,10 @@ + int aval; + aval = alarm(0); + #endif ++#ifdef POSIX ++ int aval; ++ aval = alarm(0); ++#endif + if (fork() == 0) /* child */ + { + char *shell, *base; +@@ -358,6 +362,10 @@ + #endif + #ifdef SYSV + ioctl(fileno(stdin), TCSETAW, &tty_new); ++ alarm(aval); ++#endif ++#ifdef POSIX ++ tcsetattr(fileno(stdin), TCSANOW, &tty_new); + alarm(aval); + #endif + } diff --git a/games/freebsd-games/files/patch-atc_main.c b/games/freebsd-games/files/patch-atc_main.c new file mode 100644 index 000000000000..3592011afea8 --- /dev/null +++ b/games/freebsd-games/files/patch-atc_main.c @@ -0,0 +1,47 @@ +Index: atc/main.c +@@ -173,6 +173,15 @@ + ioctl(fileno(stdin), TCSETAW, &tty_new); + #endif + ++#ifdef POSIX ++ tcgetattr(fileno(stdin), &tty_start); ++ bcopy(&tty_start, &tty_new, sizeof(tty_new)); ++ tty_new.c_lflag &= ~ICANON; ++ tty_new.c_lflag &= ~ECHO; ++ tty_new.c_cc[VMIN] = 1; ++ tty_new.c_cc[VTIME] = 0; ++ tcsetattr(fileno(stdin), TCSANOW, &tty_new); ++#endif + signal(SIGALRM, update); + + #ifdef BSD +@@ -185,6 +194,9 @@ + #ifdef SYSV + alarm(sp->update_secs); + #endif ++#ifdef POSIX ++ alarm(sp->update_secs); ++#endif + + for (;;) { + if (getcommand() != 1) +@@ -198,6 +210,9 @@ + #ifdef SYSV + alarm(0); + #endif ++#ifdef POSIX ++ alarm(0); ++#endif + + update(); + +@@ -209,6 +224,9 @@ + setitimer(ITIMER_REAL, &itv, NULL); + #endif + #ifdef SYSV ++ alarm(sp->update_secs); ++#endif ++#ifdef POSIX + alarm(sp->update_secs); + #endif + } diff --git a/games/freebsd-games/files/patch-backgammon_backgammon_main.c b/games/freebsd-games/files/patch-backgammon_backgammon_main.c index c3d4e04c2f4d..840d4ba48057 100644 --- a/games/freebsd-games/files/patch-backgammon_backgammon_main.c +++ b/games/freebsd-games/files/patch-backgammon_backgammon_main.c @@ -1,11 +1,29 @@ ---- backgammon/backgammon/main.c.orig Tue Nov 11 10:46:54 2003 -+++ backgammon/backgammon/main.c Sun Apr 16 21:21:01 2006 -@@ -53,6 +53,8 @@ - #include <signal.h> - #include "back.h" - -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) -+ - #define MVPAUSE 5 /* time to sleep when stuck */ - #define MAXUSERS 35 /* maximum number of users */ +Index: backgammon/backgammon/main.c +@@ -113,13 +111,13 @@ + signal (SIGINT,getout); /* trap interrupts */ + if (gtty (0,&tty) == -1) /* get old tty mode */ + errexit ("backgammon(gtty)"); +- old = tty.sg_flags; ++ old = tty.c_lflag; + #ifdef V7 +- raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */ ++ raw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */ + #else + raw = ((noech = old & ~ECHO) | RAW); /* set up modes */ + #endif +- ospeed = tty.sg_ospeed; /* for termlib */ ++ ospeed = cfgetospeed(&tty); /* for termlib */ + /* get terminal + * capabilities, and +@@ -135,8 +133,8 @@ + getarg (argc, argv); + args[acnt] = NULL; + if (tflag) { /* clear screen */ +- noech &= ~(CRMOD|XTABS); +- raw &= ~(CRMOD|XTABS); ++ noech &= ~(ICRNL|OXTABS); ++ raw &= ~(ICRNL|OXTABS); + clear(); + } + fixtty (raw); /* go into raw mode */ diff --git a/games/freebsd-games/files/patch-backgammon_common__source_back.h b/games/freebsd-games/files/patch-backgammon_common__source_back.h new file mode 100644 index 000000000000..2542f462c63e --- /dev/null +++ b/games/freebsd-games/files/patch-backgammon_common__source_back.h @@ -0,0 +1,25 @@ +Index: backgammon/common_source/back.h +@@ -33,7 +33,13 @@ + * @(#)back.h 8.1 (Berkeley) 5/31/93 + */ + +-#include <sgtty.h> ++#include <termios.h> ++ ++#define sg_erase c_cc[2] ++#define sg_kill c_cc[3] ++ ++#define gtty(_a,_b) tcgetattr(_a,_b) ++#define stty(_a,_b) tcsetattr(_a,TCSANOW,_b) + + #define rnum(r) (random()%r) + #define D0 dice[0] +@@ -114,7 +120,7 @@ + extern const char *const *Colorptr; /* color of current player, capitalized */ + extern int colen; /* length of color of current player */ + +-extern struct sgttyb tty; /* tty information buffer */ ++extern struct termios tty; /* tty information buffer */ + extern int old; /* original tty status */ + extern int noech; /* original tty status without echo */ + extern int raw; /* raw tty status, no echo */ diff --git a/games/freebsd-games/files/patch-backgammon_common__source_subs.c b/games/freebsd-games/files/patch-backgammon_common__source_subs.c index 54fe4a023ecb..646faa72d625 100644 --- a/games/freebsd-games/files/patch-backgammon_common__source_subs.c +++ b/games/freebsd-games/files/patch-backgammon_common__source_subs.c @@ -1,11 +1,10 @@ ---- backgammon/common_source/subs.c.orig Mon Apr 22 23:44:18 2002 -+++ backgammon/common_source/subs.c Sun Apr 16 21:27:43 2006 -@@ -44,6 +44,8 @@ - #include <string.h> - #include "back.h" - -+#define stty(_a,_b) ioctl(_a,TIOCSETP,_b) -+ - int buffnum; - char outbuff[BUFSIZ]; - +Index: backgammon/common_source/subs.c +@@ -420,7 +418,7 @@ + if (tflag) + newpos(); + buflush(); +- tty.sg_flags = mode; ++ tty.c_lflag = mode; + if (stty (0,&tty) < 0) + errexit("fixtty"); + } diff --git a/games/freebsd-games/files/patch-backgammon_teachgammon_teach.c b/games/freebsd-games/files/patch-backgammon_teachgammon_teach.c index cc5ee8c2ff46..8b1ae587e9e8 100644 --- a/games/freebsd-games/files/patch-backgammon_teachgammon_teach.c +++ b/games/freebsd-games/files/patch-backgammon_teachgammon_teach.c @@ -1,11 +1,25 @@ ---- backgammon/teachgammon/teach.c.orig Sat Feb 2 20:37:20 2002 -+++ backgammon/teachgammon/teach.c Sun Apr 16 21:22:11 2006 -@@ -52,6 +52,8 @@ - #include <signal.h> - #include "back.h" - -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) -+ - extern char *hello[]; - extern char *list[]; - extern char *intro1[]; +Index: backgammon/teachgammon/teach.c +@@ -94,18 +92,18 @@ + signal (SIGINT,getout); + if (gtty (0,&tty) == -1) /* get old tty mode */ + errexit ("teachgammon(gtty)"); +- old = tty.sg_flags; ++ old = tty.c_lflag; + #ifdef V7 +- raw = ((noech = old & ~ECHO) | CBREAK); /* set up modes */ ++ raw = ((noech = old & ~ECHO) & ~ICANON); /* set up modes */ + #else + raw = ((noech = old & ~ECHO) | RAW); /* set up modes */ + #endif +- ospeed = tty.sg_ospeed; /* for termlib */ ++ ospeed = cfgetospeed(&tty); /* for termlib */ + tflag = getcaps (getenv ("TERM")); + getarg (argc, argv); + if (tflag) { +- noech &= ~(CRMOD|XTABS); +- raw &= ~(CRMOD|XTABS); ++ noech &= ~(ICRNL|OXTABS); ++ raw &= ~(ICRNL|OXTABS); + clear(); + } + text (hello); diff --git a/games/freebsd-games/files/patch-battlestar::init.c b/games/freebsd-games/files/patch-battlestar::init.c index 077107c3e5aa..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-battlestar::init.c +++ b/games/freebsd-games/files/patch-battlestar::init.c @@ -1,11 +0,0 @@ ---- battlestar/init.c.old Mon Dec 15 17:48:41 2003 -+++ battlestar/init.c Mon Dec 15 17:48:54 2003 -@@ -62,7 +62,7 @@ - puts("Admiral D.W. Riggle\n"); - srandomdev(); - getutmp(uname); -- if (startup) -+ if (startup == NULL) - location = dayfile; - wiz = wizard(uname); - wordinit(); diff --git a/games/freebsd-games/files/patch-battlestar_init.c b/games/freebsd-games/files/patch-battlestar_init.c new file mode 100644 index 000000000000..077107c3e5aa --- /dev/null +++ b/games/freebsd-games/files/patch-battlestar_init.c @@ -0,0 +1,11 @@ +--- battlestar/init.c.old Mon Dec 15 17:48:41 2003 ++++ battlestar/init.c Mon Dec 15 17:48:54 2003 +@@ -62,7 +62,7 @@ + puts("Admiral D.W. Riggle\n"); + srandomdev(); + getutmp(uname); +- if (startup) ++ if (startup == NULL) + location = dayfile; + wiz = wizard(uname); + wordinit(); diff --git a/games/freebsd-games/files/patch-hack::Makefile b/games/freebsd-games/files/patch-hack::Makefile index eaa8d43922d1..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-hack::Makefile +++ b/games/freebsd-games/files/patch-hack::Makefile @@ -1,13 +0,0 @@ -$FreeBSD$ - ---- hack/Makefile.orig Thu Nov 20 11:06:45 2003 -+++ hack/Makefile Thu Nov 20 11:13:27 2003 -@@ -18,6 +18,8 @@ - DPADD= ${LIBTERMCAP} ${LIBCOMPAT} - LDADD= -ltermcap -lcompat - CFLAGS+= -fwritable-strings -I${.CURDIR} -I. -+BINGRP= games -+BINMODE=2555 - FILES= rumors help hh data - FILESMODE_rumors= 440 - FILESGRP= ${BINGRP} diff --git a/games/freebsd-games/files/patch-hack::hack.termcap.c b/games/freebsd-games/files/patch-hack::hack.termcap.c index de8fd532021c..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-hack::hack.termcap.c +++ b/games/freebsd-games/files/patch-hack::hack.termcap.c @@ -1,13 +0,0 @@ ---- hack/hack.termcap.c.orig Sat Mar 6 22:18:53 2004 -+++ hack/hack.termcap.c Thu Mar 11 18:42:47 2004 -@@ -35,7 +35,8 @@ - flags.nonull = 1; - if(pc = tgetstr("pc", &tbufptr)) - PC = *pc; -- if(!(BC = tgetstr("bc", &tbufptr))) { -+ if(!(BC = tgetstr("bc", &tbufptr)) -+ &&!(BC = tgetstr("le", &tbufptr))) { - if(!tgetflag("bs")) - error("Terminal must backspace."); - BC = tbufptr; - diff --git a/games/freebsd-games/files/patch-hack::hack.unix.c b/games/freebsd-games/files/patch-hack::hack.unix.c index 8143edad035c..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-hack::hack.unix.c +++ b/games/freebsd-games/files/patch-hack::hack.unix.c @@ -1,13 +0,0 @@ -$FreeBSD$ - ---- hack/hack.unix.c.orig Thu Nov 20 10:17:36 2003 -+++ hack/hack.unix.c Thu Nov 20 10:18:09 2003 -@@ -86,7 +86,7 @@ - /* old version - for people short of space */ - char *np; - -- name = "/usr/games/hide/hack"; -+ name = "%%PREFIX%%/bin/hack"; - if(stat(name, &hbuf)) - error("Cannot get status of %s.", - (np = rindex(name, '/')) ? np+1 : name); diff --git a/games/freebsd-games/files/patch-hack_Makefile b/games/freebsd-games/files/patch-hack_Makefile new file mode 100644 index 000000000000..384893572eb5 --- /dev/null +++ b/games/freebsd-games/files/patch-hack_Makefile @@ -0,0 +1,12 @@ +Index: hack/Makefile +@@ -17,7 +17,9 @@ + MAN= hack.6 + DPADD= ${LIBTERMCAP} ${LIBCOMPAT} + LDADD= -ltermcap -lcompat +-CFLAGS+= -fwritable-strings -I${.CURDIR} -I. ++CFLAGS+= -DPOSIX -I${.CURDIR} -I. ++BINGRP=games ++BINMODE=2555 + FILES= rumors help hh data + FILESMODE_rumors= 440 + FILESGRP= ${BINGRP} diff --git a/games/freebsd-games/files/patch-hack_config.h b/games/freebsd-games/files/patch-hack_config.h new file mode 100644 index 000000000000..cc7fd6cf95b2 --- /dev/null +++ b/games/freebsd-games/files/patch-hack_config.h @@ -0,0 +1,9 @@ +Index: hack/config.h +@@ -22,7 +22,6 @@ + * Also, the code for suspend and various ioctls is only given for BSD4.2 + * (I do not have access to a SYSV system.) + */ +-#define BSD /* delete this line on System V */ + + /* #define STUPID */ /* avoid some complicated expressions if + your C compiler chokes on them */ diff --git a/games/freebsd-games/files/patch-hack_hack.ioctl.c b/games/freebsd-games/files/patch-hack_hack.ioctl.c new file mode 100644 index 000000000000..cd899364bed0 --- /dev/null +++ b/games/freebsd-games/files/patch-hack_hack.ioctl.c @@ -0,0 +1,29 @@ +Index: hack/hack.ioctl.c +@@ -13,6 +13,9 @@ + #ifdef BSD + #include <sgtty.h> + struct ltchars ltchars, ltchars0; ++#elif POSIX ++#include <termios.h> ++struct termios termio; + #else + #include <termio.h> /* also includes part of <sgtty.h> */ + struct termio termio; +@@ -22,6 +25,8 @@ + #ifdef BSD + (void) ioctl(fileno(stdin), (int) TIOCGLTC, (char *) <chars); + (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars0); ++#elif POSIX ++ tcgetattr(fileno(stdin), &termio); + #else + (void) ioctl(fileno(stdin), (int) TCGETA, &termio); + #endif /* BSD */ +@@ -30,6 +35,8 @@ + setioctls() { + #ifdef BSD + (void) ioctl(fileno(stdin), (int) TIOCSLTC, (char *) <chars); ++#elif POSIX ++ tcsetattr(fileno(stdin), TCSANOW, &termio); + #else + (void) ioctl(fileno(stdin), (int) TCSETA, &termio); + #endif /* BSD */ diff --git a/games/freebsd-games/files/patch-hack_hack.pager.c b/games/freebsd-games/files/patch-hack_hack.pager.c new file mode 100644 index 000000000000..3a9df40b839e --- /dev/null +++ b/games/freebsd-games/files/patch-hack_hack.pager.c @@ -0,0 +1,10 @@ +Index: hack/hack.pager.c +@@ -367,6 +367,8 @@ + #else + + #ifdef BSD ++#include <sys/wait.h> ++#elif POSIX + #include <sys/wait.h> + #else + #include <wait.h> diff --git a/games/freebsd-games/files/patch-hack_hack.termcap.c b/games/freebsd-games/files/patch-hack_hack.termcap.c new file mode 100644 index 000000000000..de8fd532021c --- /dev/null +++ b/games/freebsd-games/files/patch-hack_hack.termcap.c @@ -0,0 +1,13 @@ +--- hack/hack.termcap.c.orig Sat Mar 6 22:18:53 2004 ++++ hack/hack.termcap.c Thu Mar 11 18:42:47 2004 +@@ -35,7 +35,8 @@ + flags.nonull = 1; + if(pc = tgetstr("pc", &tbufptr)) + PC = *pc; +- if(!(BC = tgetstr("bc", &tbufptr))) { ++ if(!(BC = tgetstr("bc", &tbufptr)) ++ &&!(BC = tgetstr("le", &tbufptr))) { + if(!tgetflag("bs")) + error("Terminal must backspace."); + BC = tbufptr; + diff --git a/games/freebsd-games/files/patch-hack_hack.tty.c b/games/freebsd-games/files/patch-hack_hack.tty.c index 03cad9a090dc..07a126779f6a 100644 --- a/games/freebsd-games/files/patch-hack_hack.tty.c +++ b/games/freebsd-games/files/patch-hack_hack.tty.c @@ -1,13 +1,42 @@ ---- hack/hack.tty.c Wed Jun 23 21:36:26 2004 -+++ hack/hack.tty.c Wed Jun 23 21:50:12 2004 -@@ -95,8 +95,8 @@ - #define CBRKMASK CBREAK - #define CBRKON /* empty */ - #define OSPEED(x) (x).sg_ospeed --#define GTTY(x) (gtty(0, x)) --#define STTY(x) (stty(0, x)) -+#define GTTY(x) (ioctl(0, TIOCGETP, x)) -+#define STTY(x) (ioctl(0, TIOCSETP, x)) +Index: hack/hack.tty.c +@@ -53,6 +53,7 @@ + */ + #ifdef BSD + #define V7 ++#elif POSIX + #else + #define USG + #endif /* BSD */ +@@ -82,6 +83,21 @@ + #define GTTY(x) (ioctl(0, TCGETA, x)) + #define STTY(x) (ioctl(0, TCSETA, x)) /* TCSETAF? TCSETAW? */ - #endif /* USG */ ++#elif POSIX ++#include <termios.h> ++#define termstruct termios ++#define kill_sym c_cc[VKILL] ++#define erase_sym c_cc[VERASE] ++#define EXTABS OXTABS ++#define tabflgs c_oflag ++#define echoflgs c_lflag ++#define cbrkflgs c_lflag ++#define CBRKMASK ICANON ++#define CBRKON ! /* reverse condition */ ++#define OSPEED(x) cfgetospeed(x) ++#define GTTY(x) tcgetattr(fileno(stdin),x) ++#define STTY(x) tcsetattr(fileno(stdin),TCSANOW,x) /* TCSETAF? TCSETAW? */ ++ + #else /* V7 */ + #include <sgtty.h> +@@ -169,6 +185,10 @@ + /* be satisfied with one character; no timeout */ + curttyb.c_cc[VMIN] = 1; /* was VEOF */ + curttyb.c_cc[VTIME] = 0; /* was VEOL */ ++#elif POSIX ++ /* be satisfied with one character; no timeout */ ++ curttyb.c_cc[VMIN] = 1; /* was VEOF */ ++ curttyb.c_cc[VTIME] = 0; /* was VEOL */ + #endif /* USG */ + change++; + } diff --git a/games/freebsd-games/files/patch-hack_hack.unix.c b/games/freebsd-games/files/patch-hack_hack.unix.c new file mode 100644 index 000000000000..5d68f6cbef74 --- /dev/null +++ b/games/freebsd-games/files/patch-hack_hack.unix.c @@ -0,0 +1,13 @@ +$FreeBSD: /tmp/pcvs/ports/games/freebsd-games/files/Attic/patch-hack_hack.unix.c,v 1.1 2007-03-23 23:02:33 nox Exp $ + +--- hack/hack.unix.c.orig Thu Nov 20 10:17:36 2003 ++++ hack/hack.unix.c Thu Nov 20 10:18:09 2003 +@@ -86,7 +86,7 @@ + /* old version - for people short of space */ + char *np; + +- name = "/usr/games/hide/hack"; ++ name = "%%PREFIX%%/bin/hack"; + if(stat(name, &hbuf)) + error("Cannot get status of %s.", + (np = rindex(name, '/')) ? np+1 : name); diff --git a/games/freebsd-games/files/patch-larn::diag.c b/games/freebsd-games/files/patch-larn::diag.c index f3cf3d0a5c8b..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-larn::diag.c +++ b/games/freebsd-games/files/patch-larn::diag.c @@ -1,31 +0,0 @@ -$FreeBSD$ - ---- larn/diag.c 17 Jun 2003 04:25:24 -0000 1.2 -+++ larn/diag.c 21 Jun 2004 02:28:34 -0000 1.3 -@@ -210,7 +210,7 @@ - if (beenhere[k]) - lrfill((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX); - -- lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint(); -+ lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint_x(); - level = c[CAVELEVEL] = lgetc(); - playerx = lgetc(); playery = lgetc(); - lrfill((char*)iven,26); lrfill((char*)ivenarg,26*sizeof(short)); -@@ -241,7 +241,7 @@ - } - - time(&zzz); -- initialtime = zzz-lrint(); -+ initialtime = zzz-lrint_x(); - fstat(fd,&filetimes); /* get the creation and modification time of file */ - lrfill((char*)&zzz,sizeof(long)); zzz += 6; - if (filetimes.st_ctime > zzz) fsorry(); /* file create time */ -@@ -249,7 +249,7 @@ - if (c[HP]<0) { died(284); return; } /* died a post mortem death */ - - oldx = oldy = 0; -- i = lrint(); /* inode # */ -+ i = lrint_x(); /* inode # */ - if (i && (filetimes.st_ino!=i)) fsorry(); - lrclose(); - if (strcmp(fname,ckpfile) == 0) diff --git a/games/freebsd-games/files/patch-larn::header.h b/games/freebsd-games/files/patch-larn::header.h index ea58c01c7952..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-larn::header.h +++ b/games/freebsd-games/files/patch-larn::header.h @@ -1,13 +0,0 @@ -$FreeBSD$ - ---- larn/header.h 17 Jun 2003 02:49:28 -0000 1.1 -+++ larn/header.h 21 Jun 2004 02:28:34 -0000 1.2 -@@ -359,7 +359,7 @@ - - char *fortune(),*lgetw(),*lgetl(); - char *tmcapcnv(); --long paytaxes(),lgetc(),lrint(); -+long paytaxes(),lgetc(),lrint_x(); - unsigned long readnum(); - - /* macro to create scroll #'s with probability of occurrence */ diff --git a/games/freebsd-games/files/patch-larn::io.c b/games/freebsd-games/files/patch-larn::io.c index b36c953d59bd..e69de29bb2d1 100644 --- a/games/freebsd-games/files/patch-larn::io.c +++ b/games/freebsd-games/files/patch-larn::io.c @@ -1,39 +0,0 @@ ---- larn/io.c.orig Thu May 9 06:39:10 2002 -+++ larn/io.c Sun Apr 16 20:40:41 2006 -@@ -24,7 +24,7 @@ - * FILE INPUT ROUTINES - * - * long lgetc() read one character from input buffer -- * long lrint() read one integer from input buffer -+ * long lrint_x() read one integer from input buffer - * lrfill(address,number) put input bytes into a buffer - * char *lgetw() get a whitespace ended word from input - * char *lgetl() get a \n or EOF ended line from input -@@ -75,6 +75,9 @@ - #define CBREAK RAW /* V7 has no CBREAK */ - #endif - -+#define stty(_a,_b) ioctl(_a,TIOCSETP,_b) -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) -+ - #define doraw(_a) (_a.sg_flags |= CBREAK,_a.sg_flags &= ~ECHO) - #define unraw(_a) (_a.sg_flags &= ~CBREAK,_a.sg_flags |= ECHO) - #include <sgtty.h> -@@ -345,7 +348,7 @@ - } - - /* -- * long lrint() Read one integer from input buffer -+ * long lrint_x() Read one integer from input buffer - * - * +---------+---------+---------+---------+ - * | high | | | low | -@@ -357,7 +360,7 @@ - * The save order is low order first, to high order (4 bytes total) - * Returns the int read - */ --long lrint() -+long lrint_x() - { - unsigned long i; - i = 255 & lgetc(); i |= (255 & lgetc()) << 8; diff --git a/games/freebsd-games/files/patch-larn_Makefile b/games/freebsd-games/files/patch-larn_Makefile new file mode 100644 index 000000000000..3671991924cb --- /dev/null +++ b/games/freebsd-games/files/patch-larn_Makefile @@ -0,0 +1,10 @@ +Index: larn/Makefile +@@ -54,7 +54,7 @@ + + PROG= larn + MAN= larn.6 +-CFLAGS+=-DBSD -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -fwritable-strings -DNOVARARGS ++CFLAGS+=-DPOSIX -DVER=12 -DSUBVER=0 -DNONAP -DUIDSCORE -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 diff --git a/games/freebsd-games/files/patch-larn_diag.c b/games/freebsd-games/files/patch-larn_diag.c new file mode 100644 index 000000000000..7f65679c9092 --- /dev/null +++ b/games/freebsd-games/files/patch-larn_diag.c @@ -0,0 +1,31 @@ +$FreeBSD: /tmp/pcvs/ports/games/freebsd-games/files/Attic/patch-larn_diag.c,v 1.1 2007-03-23 23:02:33 nox Exp $ + +--- larn/diag.c 17 Jun 2003 04:25:24 -0000 1.2 ++++ larn/diag.c 21 Jun 2004 02:28:34 -0000 1.3 +@@ -210,7 +210,7 @@ + if (beenhere[k]) + lrfill((char*)&cell[k*MAXX*MAXY],sizeof(struct cel)*MAXY*MAXX); + +- lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint(); ++ lrfill((char*)&c[0],100*sizeof(long)); gtime = lrint_x(); + level = c[CAVELEVEL] = lgetc(); + playerx = lgetc(); playery = lgetc(); + lrfill((char*)iven,26); lrfill((char*)ivenarg,26*sizeof(short)); +@@ -241,7 +241,7 @@ + } + + time(&zzz); +- initialtime = zzz-lrint(); ++ initialtime = zzz-lrint_x(); + fstat(fd,&filetimes); /* get the creation and modification time of file */ + lrfill((char*)&zzz,sizeof(long)); zzz += 6; + if (filetimes.st_ctime > zzz) fsorry(); /* file create time */ +@@ -249,7 +249,7 @@ + if (c[HP]<0) { died(284); return; } /* died a post mortem death */ + + oldx = oldy = 0; +- i = lrint(); /* inode # */ ++ i = lrint_x(); /* inode # */ + if (i && (filetimes.st_ino!=i)) fsorry(); + lrclose(); + if (strcmp(fname,ckpfile) == 0) diff --git a/games/freebsd-games/files/patch-larn_header.h b/games/freebsd-games/files/patch-larn_header.h new file mode 100644 index 000000000000..96f43651a9c7 --- /dev/null +++ b/games/freebsd-games/files/patch-larn_header.h @@ -0,0 +1,18 @@ +Index: larn/header.h +@@ -326,7 +326,6 @@ + #define DEMONLORD 57 + #define DEMONPRINCE 64 + +-#define NULL 0 + #define BUFBIG 4096 /* size of the output buffer */ + #define MAXIBUF 4096 /* size of the input buffer */ + #define LOGNAMESIZE 40 /* max size of the players name */ +@@ -359,7 +359,7 @@ + + char *fortune(),*lgetw(),*lgetl(); + char *tmcapcnv(); +-long paytaxes(),lgetc(),lrint(); ++long paytaxes(),lgetc(),lrint_x(); + unsigned long readnum(); + + /* macro to create scroll #'s with probability of occurrence */ diff --git a/games/freebsd-games/files/patch-larn_io.c b/games/freebsd-games/files/patch-larn_io.c new file mode 100644 index 000000000000..bbbb35860082 --- /dev/null +++ b/games/freebsd-games/files/patch-larn_io.c @@ -0,0 +1,46 @@ +Index: larn/io.c +@@ -24,7 +24,7 @@ + * FILE INPUT ROUTINES + * + * long lgetc() read one character from input buffer +- * long lrint() read one integer from input buffer ++ * long lrint_x() read one integer from input buffer + * lrfill(address,number) put input bytes into a buffer + * char *lgetw() get a whitespace ended word from input + * char *lgetl() get a \n or EOF ended line from input +@@ -69,6 +69,17 @@ + _a.c_cc[VMIN]=1;_a.c_cc[VTIME]=1;_a.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL) + #define unraw(_a) _a.c_cc[VMIN]=saveeof;_a.c_cc[VTIME]=saveeol;_a.c_lflag |= ICANON|ECHO|ECHOE|ECHOK|ECHONL + ++#elif POSIX ++#include <termios.h> ++#define sgttyb termios ++#define gtty(_a,_b) tcgetattr(_a,_b) ++#define stty(_a,_b) tcsetattr(_a,TCSANOW,_b) ++static int rawflg = 0; ++static char saveeof,saveeol; ++#define doraw(_a) if(!rawflg){++rawflg;saveeof=_a.c_cc[VMIN];saveeol=_a.c_cc[VTIME];}\ ++ _a.c_cc[VMIN]=1;_a.c_cc[VTIME]=1;_a.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL) ++#define unraw(_a) _a.c_cc[VMIN]=saveeof;_a.c_cc[VTIME]=saveeol;_a.c_lflag |= ICANON|ECHO|ECHOE|ECHOK|ECHONL ++ + #else /* not SYSV */ + + #ifndef BSD +@@ -345,7 +356,7 @@ + } + + /* +- * long lrint() Read one integer from input buffer ++ * long lrint_x() Read one integer from input buffer + * + * +---------+---------+---------+---------+ + * | high | | | low | +@@ -357,7 +368,7 @@ + * The save order is low order first, to high order (4 bytes total) + * Returns the int read + */ +-long lrint() ++long lrint_x() + { + unsigned long i; + i = 255 & lgetc(); i |= (255 & lgetc()) << 8; diff --git a/games/freebsd-games/files/patch-snake_snake_move.c b/games/freebsd-games/files/patch-snake_snake_move.c index 225ef0c151bf..03f96cdc9885 100644 --- a/games/freebsd-games/files/patch-snake_snake_move.c +++ b/games/freebsd-games/files/patch-snake_snake_move.c @@ -1,12 +1,24 @@ ---- snake/snake/move.c.orig Wed May 29 02:54:00 2002 -+++ snake/snake/move.c Sun Apr 16 21:04:37 2006 -@@ -103,6 +103,9 @@ +Index: snake/snake/move.c +@@ -677,10 +674,10 @@ - #include "snake.h" + gtty(0, &orig); + new=orig; +- new.sg_flags &= ~(ECHO|CRMOD|ALLDELAY|XTABS); +- new.sg_flags |= CBREAK; ++ new.c_lflag &= ~(ECHO|ICRNL|OXTABS); ++ new.c_lflag &= ~ICANON; + signal(SIGINT,stop); +- ospeed = orig.sg_ospeed; ++ ospeed = cfgetospeed(&orig); + #ifdef TIOCGLTC + ioctl(0, TIOCGLTC, &olttyc); + nlttyc = olttyc; +@@ -689,7 +686,7 @@ + #endif + raw(); -+#define stty(_a,_b) ioctl(_a,TIOCSETP,_b) -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) -+ - int CMlength; - int NDlength; - int BSlength; +- if ((orig.sg_flags & XTABS) == XTABS) TA=0; ++ if ((orig.c_lflag & OXTABS) == OXTABS) TA=0; + putpad(KS); + putpad(TI); + point(&cursor,0,LINES-1); diff --git a/games/freebsd-games/files/patch-snake_snake_snake.c b/games/freebsd-games/files/patch-snake_snake_snake.c index a59d7e434f7b..11c001d38bf6 100644 --- a/games/freebsd-games/files/patch-snake_snake_snake.c +++ b/games/freebsd-games/files/patch-snake_snake_snake.c @@ -1,11 +1,10 @@ ---- snake/snake/snake.c.orig Tue Nov 11 10:47:06 2003 -+++ snake/snake/snake.c Sun Apr 16 21:04:54 2006 -@@ -68,6 +68,8 @@ - #include "snake.h" - #include "pathnames.h" +Index: snake/snake/snake.c +@@ -183,7 +181,7 @@ + snrand(&money); + snrand(&snake[0]); -+#define stty(_a,_b) ioctl(_a,TIOCSETP,_b) -+ - #define PENALTY 10 /* % penalty for invoking spacewarp */ - - #define EOT '\004' +- if ((orig.sg_ospeed < B9600) || ++ if ((cfgetospeed(&orig) < B9600) || + ((! CM) && (! TA))) fast=0; + for(i=1;i<6;i++) + chase (&snake[i], &snake[i-1]); diff --git a/games/freebsd-games/files/patch-snake_snake_snake.h b/games/freebsd-games/files/patch-snake_snake_snake.h new file mode 100644 index 000000000000..a89166ac21f3 --- /dev/null +++ b/games/freebsd-games/files/patch-snake_snake_snake.h @@ -0,0 +1,25 @@ +Index: snake/snake/snake.h +@@ -38,10 +38,13 @@ + # include <stdio.h> + # include <assert.h> + # include <sys/types.h> +-# include <sgtty.h> ++# include <termios.h> + # include <signal.h> + # include <math.h> + ++#define gtty(_a,_b) tcgetattr(_a,_b) ++#define stty(_a,_b) tcsetattr(_a,TCSANOW,_b) ++ + #define ESC '\033' + + struct tbuffer { +@@ -72,7 +75,7 @@ + int col, line; + }; + struct point cursor; +-struct sgttyb orig, new; ++struct termios orig, new; + #ifdef TIOCLGET + struct ltchars olttyc, nlttyc; + #endif diff --git a/games/freebsd-games/files/patch-trek_main.c b/games/freebsd-games/files/patch-trek_main.c index 684bc7f0074c..c6880a8a5893 100644 --- a/games/freebsd-games/files/patch-trek_main.c +++ b/games/freebsd-games/files/patch-trek_main.c @@ -1,11 +1,33 @@ ---- trek/main.c.orig Mon Jun 24 04:29:52 2002 -+++ trek/main.c Sun Apr 16 21:26:44 2006 -@@ -51,6 +51,8 @@ +Index: trek/main.c +@@ -47,10 +47,12 @@ + + # include "trek.h" + # include <stdio.h> +-# include <sgtty.h> ++# include <termios.h> # include <setjmp.h> # include <stdlib.h> -+#define gtty(_a,_b) ioctl(_a,TIOCGETP,_b) ++# define gtty(_a,_b) tcgetattr(_a,_b) + # define PRIO 00 /* default priority */ int Mother = 51 + (51 << 8); +@@ -163,7 +165,7 @@ + int prio; + int ac; + char **av; +- struct sgttyb argp; ++ struct termios argp; + + /* revoke */ + setgid(getgid()); +@@ -176,7 +178,7 @@ + prio = PRIO; + if (gtty(1, &argp) == 0) + { +- if ((argp.sg_ispeed ) < B1200) ++ if ((cfgetispeed(&argp)) < B1200) + Etc.fast++; + } + while (ac > 1 && av[0][0] == '-') |