aboutsummaryrefslogtreecommitdiff
path: root/chinese/cxterm
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2008-02-12 23:27:45 +0000
committerMartin Wilke <miwi@FreeBSD.org>2008-02-12 23:27:45 +0000
commitff0e2fa0889070ea9a2c3cb5f27ae9b9f28f94c5 (patch)
treef64c733ea7dfd8d4185dbaabba9b43bd8a872bdb /chinese/cxterm
parent94a7d5f38f240dab26c9c6f719a702ddc0b7629f (diff)
downloadports-ff0e2fa0889070ea9a2c3cb5f27ae9b9f28f94c5.tar.gz
ports-ff0e2fa0889070ea9a2c3cb5f27ae9b9f28f94c5.zip
-Use termios, not sgtty
PR: 120061 Submitted by: Ed Schouten <ed@fxq.nl> Approved by: maintainer
Notes
Notes: svn path=/head/; revision=207124
Diffstat (limited to 'chinese/cxterm')
-rw-r--r--chinese/cxterm/files/patch-main.c98
-rw-r--r--chinese/cxterm/files/patch-utils_hzimctrl.c75
2 files changed, 166 insertions, 7 deletions
diff --git a/chinese/cxterm/files/patch-main.c b/chinese/cxterm/files/patch-main.c
index 1ba7f91b3439..05ee031b26cd 100644
--- a/chinese/cxterm/files/patch-main.c
+++ b/chinese/cxterm/files/patch-main.c
@@ -1,12 +1,100 @@
--- cxterm/main.c.orig Fri Oct 25 11:44:46 2002
+++ cxterm/main.c Fri Oct 25 11:47:13 2002
-@@ -223,6 +223,9 @@
- #ifndef linux
- #include <sgtty.h>
+@@ -220,8 +220,13 @@
+ #define HAS_UTMP_UT_HOST
#endif
+ #else /* } !SYSV { */ /* BSD systems */
+-#ifndef linux
+-#include <sgtty.h>
+#ifdef __FreeBSD__
++#include <termios.h>
++#define USE_TERMIOS
++#define USE_TERMINFO
++#define USE_SYSV_TERMIO
++#define termio termios
+#define USE_POSIX_WAIT
-+#endif
+ #endif
#include <sys/resource.h>
#define HAS_UTMP_UT_HOST
- #define HAS_BSD_GROUPS
+@@ -968,7 +973,7 @@
+ ** implementation to implementation).
+ */
+ d_tio.c_iflag = ICRNL|IXON;
+- d_tio.c_oflag = OPOST|ONLCR|TAB3;
++ d_tio.c_oflag = OPOST|ONLCR|OXTABS;
+ #if defined(macII) || defined(ATT) || defined(CRAY) || (defined(sun) && defined(SVR4)) /* { */
+ #ifndef HANZI
+ d_tio.c_cflag = B9600|CS8|CREAD|PARENB|HUPCL;
+@@ -1036,11 +1041,13 @@
+ #ifdef ECHOCTL
+ d_tio.c_lflag |= ECHOCTL|IEXTEN;
+ #endif
++#ifndef __FreeBSD__
+ #ifdef NTTYDISC
+ d_tio.c_line = NTTYDISC;
+ #else
+ d_tio.c_line = 0;
+ #endif
++#endif
+ #ifdef sgi
+ d_tio.c_cflag &= ~(HUPCL|PARENB);
+ d_tio.c_iflag |= BRKINT|ISTRIP|IGNPAR;
+@@ -1090,7 +1097,11 @@
+
+ for (i = 0; i <= 2; i++) {
+ struct termio deftio;
++#ifdef USE_TERMIOS
++ if (tcgetattr(i, &deftio) == 0) {
++#else
+ if (ioctl (i, TCGETA, &deftio) == 0) {
++#endif
+ d_tio.c_cc[VINTR] = deftio.c_cc[VINTR];
+ d_tio.c_cc[VQUIT] = deftio.c_cc[VQUIT];
+ d_tio.c_cc[VERASE] = deftio.c_cc[VERASE];
+@@ -1970,7 +1981,11 @@
+ lmode = d_lmode;
+ #endif /* TIOCLSET */
+ #ifdef USE_SYSV_TERMIO
++#ifdef USE_TERMIOS
++ if(tcgetattr(tty, &tio) == -1)
++#else
+ if(ioctl(tty, TCGETA, &tio) == -1)
++#endif
+ tio = d_tio;
+
+ #else /* not USE_SYSV_TERMIO */
+@@ -2340,19 +2355,17 @@
+ #endif /* ISTRIP */
+ #endif /* HANZI */
+ /* ouput: cr->cr, nl is not return, no delays, ln->cr/nl */
+- tio.c_oflag &=
+- ~(OCRNL|ONLRET|NLDLY|CRDLY|TABDLY|BSDLY|VTDLY|FFDLY);
++ tio.c_oflag &= ~(OCRNL|ONLRET);
+ tio.c_oflag |= ONLCR;
+ #ifdef OPOST
+ tio.c_oflag |= OPOST;
+ #endif /* OPOST */
+ #ifdef BAUD_0
+ /* baud rate is 0 (don't care) */
+- tio.c_cflag &= ~(CBAUD);
++ cfsetspeed(&tio, 0);
+ #else /* !BAUD_0 */
+ /* baud rate is 9600 (nice default) */
+- tio.c_cflag &= ~(CBAUD);
+- tio.c_cflag |= B9600;
++ cfsetspeed(&tio, 9600);
+ #endif /* !BAUD_0 */
+ tio.c_cflag &= ~CSIZE;
+ #ifndef HANZI
+@@ -2476,7 +2489,11 @@
+ if (ioctl (tty, TIOCLSET, (char *)&lmode) == -1)
+ HsSysError(cp_pipe[1], ERROR_TIOCLSET);
+ #endif /* TIOCLSET */
++#ifdef USE_TERMIOS
++ if (tcsetattr(tty, TCSANOW, &tio) == -1)
++#else
+ if (ioctl (tty, TCSETA, &tio) == -1)
++#endif
+ HsSysError(cp_pipe[1], ERROR_TIOCSETP);
+ #else /* USE_SYSV_TERMIO */
+ sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW);
diff --git a/chinese/cxterm/files/patch-utils_hzimctrl.c b/chinese/cxterm/files/patch-utils_hzimctrl.c
index d49d5d80dce4..366f35efd919 100644
--- a/chinese/cxterm/files/patch-utils_hzimctrl.c
+++ b/chinese/cxterm/files/patch-utils_hzimctrl.c
@@ -1,6 +1,26 @@
--- utils/hzimctrl.c.orig 2007-11-22 14:25:31.000000000 +0100
+++ utils/hzimctrl.c 2007-11-22 14:25:47.000000000 +0100
-@@ -112,6 +112,11 @@
+@@ -67,12 +67,19 @@
+ #define USE_SYSV_TERMIO
+ #endif /* SYSV */
+
++#ifdef __FreeBSD__
++#define USE_SYSV_TERMIO
++#define USE_TERMIOS
++#include <termios.h>
++#define termio termios
++#else /* !__FreeBSD__ */
+ #include <sys/ioctl.h>
+ #ifdef USE_SYSV_TERMIO
+ #include <sys/termio.h>
+ #else /* else not USE_SYSV_TERMIO */
+ #include <sgtty.h>
+ #endif /* USE_SYSV_TERMIO */
++#endif /* __FreeBSD__ */
+
+ #ifdef SYSV
+ #ifdef USE_USG_PTYS
+@@ -112,6 +119,11 @@
char *setim = "\033]161;%s\007"; /* esc seq for set hz input method */
char *setparam = "\033]162;%s\007"; /* esc seq for set input param */
@@ -12,7 +32,7 @@
/*
set input method
*/
-@@ -127,10 +132,6 @@
+@@ -127,10 +139,6 @@
#endif /* USE_SYSV_TERMIO */
char buf[BUFSIZ];
char *name_of_tty;
@@ -23,3 +43,54 @@
ptr = strrchr(myname = argv[0], '/');
if (ptr)
+@@ -179,9 +187,13 @@
+ tty = fileno(ttyfp);
+
+ #ifdef USE_SYSV_TERMIO
++#ifdef USE_TERMIOS
++ tcgetattr(tty, &tioorig);
++#else
+ ioctl (tty, TCGETA, &tioorig);
++#endif
+ tio = tioorig;
+- tio.c_iflag &= ~(ICRNL | IUCLC);
++ tio.c_iflag &= ~(ICRNL);
+ tio.c_lflag &= ~(ICANON | ECHO);
+ tio.c_cflag |= CS8;
+ tio.c_cc[VMIN] = 6;
+@@ -196,7 +208,11 @@
+ signal(SIGQUIT, onintr);
+ signal(SIGTERM, onintr);
+ #ifdef USE_SYSV_TERMIO
++#ifdef USE_TERMIOS
++ tcsetattr(tty, TCSADRAIN, &tio);
++#else
+ ioctl (tty, TCSETAW, &tio);
++#endif
+ #else /* not USE_SYSV_TERMIO */
+ ioctl (tty, TIOCSETP, &sg);
+ #endif /* USE_SYSV_TERMIO */
+@@ -204,7 +220,11 @@
+ write(tty, buf, strlen(buf));
+
+ #ifdef USE_SYSV_TERMIO
++#ifdef USE_TERMIOS
++ tcsetattr(tty, TCSADRAIN, &tioorig);
++#else
+ ioctl (tty, TCSETAW, &tioorig);
++#endif
+ #else /* not USE_SYSV_TERMIO */
+ ioctl (tty, TIOCSETP, &sgorig);
+ #endif /* USE_SYSV_TERMIO */
+@@ -228,7 +248,11 @@
+ int sig;
+ {
+ #ifdef USE_SYSV_TERMIO
++#ifdef USE_TERMIOS
++ tcsetattr(tty, TCSADRAIN, &tioorig);
++#else
+ ioctl (tty, TCSETAW, &tioorig);
++#endif
+ #else /* not USE_SYSV_TERMIO */
+ ioctl (tty, TIOCSETP, &sgorig);
+ #endif /* USE_SYSV_TERMIO */