ports/120096: [Patch] vietnamese/vnterm: use termios, not sgtty

Ed Schouten ed at fxq.nl
Mon Jan 28 20:20:01 UTC 2008


>Number:         120096
>Category:       ports
>Synopsis:       [Patch] vietnamese/vnterm: use termios, not sgtty
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Jan 28 20:20:00 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator:     Ed Schouten
>Release:        FreeBSD 6.3-PRERELEASE i386
>Organization:
>Environment:
System: FreeBSD palm.hoeg.nl 6.3-PRERELEASE FreeBSD 6.3-PRERELEASE #0: Wed Dec 19 16:07:46 CET 2007 ed at palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386
>Description:
Just like hanterm, kterm16c and cxterm, vnterm is a fork of xterm that
adds support for international character input. We can patch this port
in a similar way as the others to use termios instead of sgtty, which
makes the port work properly when COMPAT_43TTY has been removed from the
kernel.

This is one of the last ports that uses sgtty, so if we fix this one, we
could remove sgtty in the future.
>How-To-Repeat:
>Fix:
The following patch changes the existing patch in the files/ directory
to change main.c even further to use termios. This patch is similar to
the ones I wrote for the other terminals.

--- vietnamese/vnterm/files/patch-main.c	2002-09-09 04:37:41.000000000 +0200
+++ vietnamese/vnterm/files/patch-main.c	2008-01-28 08:36:12.000000000 +0100
@@ -1,6 +1,6 @@
 --- main.c.orig	Mon Aug 21 08:47:47 2000
 +++ main.c	Sun Sep  8 19:35:54 2002
-@@ -76,6 +76,9 @@
+@@ -80,6 +80,9 @@
  #include "data.h"
  #include "error.h"
  #include "menu.h"
@@ -10,18 +10,23 @@
  
  #ifdef att
  #define ATT
-@@ -279,6 +282,10 @@
+@@ -224,8 +227,13 @@
+ #define HAS_UTMP_UT_HOST
  #endif
- #include <sys/param.h>	/* for NOFILE */
- 
-+#if (defined(BSD) && (BSD >= 199103))
+ #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
-+
- #ifdef  PUCC_PTYD
- #include <local/openpty.h>
- int	Ptyfd;
-@@ -421,7 +428,11 @@
+ #endif
+ #include <sys/resource.h>
+ #define HAS_UTMP_UT_HOST
+@@ -425,7 +433,11 @@
          CFLUSH, CWERASE, CLNEXT
  };
  static int d_disipline = NTTYDISC;
@@ -33,7 +38,7 @@
  #ifdef sony
  static long int d_jmode = KM_SYSSJIS|KM_ASCII;
  static struct jtchars d_jtc = {
-@@ -586,6 +597,11 @@
+@@ -590,6 +602,11 @@
      Boolean sunFunctionKeys;	/* %%% should be widget resource? */
      Boolean wait_for_map;
      Boolean useInsertMode;
@@ -45,7 +50,7 @@
  } resource;
  
  /* used by VT (charproc.c) */
-@@ -613,6 +629,14 @@
+@@ -617,6 +634,14 @@
          offset(wait_for_map), XtRString, "false"},
      {"useInsertMode", "UseInsertMode", XtRBoolean, sizeof (Boolean),
          offset(useInsertMode), XtRString, "false"},
@@ -60,7 +65,7 @@
  };
  #undef offset
  
-@@ -621,7 +645,7 @@
+@@ -625,7 +650,7 @@
      "XTerm*SimpleMenu*HorizontalMargins: 16",
      "XTerm*SimpleMenu*Sme.height: 16",
      "XTerm*SimpleMenu*Cursor: left_ptr",
@@ -69,7 +74,7 @@
      "XTerm*vtMenu.Label:  VT Options (no app-defaults)",
      "XTerm*fontMenu.Label:  VT Fonts (no app-defaults)",
      "XTerm*tekMenu.Label:  Tek Options (no app-defaults)",
-@@ -693,6 +717,13 @@
+@@ -697,6 +722,13 @@
  {"+im",		"*useInsertMode", XrmoptionNoArg,	(caddr_t) "off"},
  {"-vb",		"*visualBell",	XrmoptionNoArg,		(caddr_t) "on"},
  {"+vb",		"*visualBell",	XrmoptionNoArg,		(caddr_t) "off"},
@@ -83,7 +88,7 @@
  {"-wf",		"*waitForMap",	XrmoptionNoArg,		(caddr_t) "on"},
  {"+wf",		"*waitForMap",	XrmoptionNoArg,		(caddr_t) "off"},
  /* bogus old compatibility stuff for which there are
-@@ -770,6 +801,11 @@
+@@ -774,6 +806,11 @@
  #endif
  { "-/+vb",                 "turn on/off visual bell" },
  { "-/+wf",                 "turn on/off wait for map before command exec" },
@@ -95,7 +100,7 @@
  { "-e command args ...",   "command to execute" },
  { "%geom",                 "Tek window geometry" },
  { "#geom",                 "icon window geometry" },
-@@ -815,6 +851,11 @@
+@@ -819,6 +856,11 @@
  
      fprintf (stderr, "\r\n\nType %s -help for a full description.\r\n\n",
  	     ProgramName);
@@ -107,7 +112,7 @@
      exit (1);
  }
  
-@@ -836,6 +877,11 @@
+@@ -840,6 +882,11 @@
  	putc ('\n', stderr);
      }
      putc ('\n', stderr);
@@ -119,7 +124,7 @@
  
      exit (0);
  }
-@@ -926,6 +972,11 @@
+@@ -930,6 +977,11 @@
  	int mode;
  	char *base_name();
  	int xerror(), xioerror();
@@ -131,7 +136,42 @@
  
  	XtSetLanguageProc (NULL, NULL, NULL);
  
-@@ -1150,6 +1201,39 @@
+@@ -961,7 +1013,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) /* { */
+     	d_tio.c_cflag = B9600|CS8|CREAD|PARENB|HUPCL;
+     	d_tio.c_lflag = ISIG|ICANON|ECHO|ECHOE|ECHOK;
+@@ -1019,11 +1071,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;
+@@ -1073,7 +1127,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];
+@@ -1154,6 +1212,39 @@
  				  XtNumber(application_resources), NULL, 0);
  
  	waiting_for_initial_map = resource.wait_for_map;
@@ -171,7 +211,7 @@
  
  	/*
  	 * ICCCM delete_window.
-@@ -1255,6 +1339,11 @@
+@@ -1259,6 +1350,11 @@
  
  	if (screen->savelines < 0) screen->savelines = 0;
  
@@ -183,7 +223,42 @@
  	term->flags = 0;
  	if (!screen->jumpscroll) {
  	    term->flags |= SMOOTHSCROLL;
-@@ -2417,6 +2506,10 @@
+@@ -1938,7 +2034,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 */
+@@ -2299,19 +2399,17 @@
+ 		    tio.c_iflag &= ~(INLCR|IGNCR);
+ 		    tio.c_iflag |= ICRNL;
+ 		    /* 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;
+ 		    if (screen->input_eight_bits)
+@@ -2421,10 +2519,18 @@
  			    HsSysError(cp_pipe[1], ERROR_TIOCSETC);
  #endif	/* TIOCSLTC */
  #ifdef TIOCLSET
@@ -194,3 +269,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);
Only in vnterm: work
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list