ports/124460: [Patch] math/calctool: make it use termios
Ed Schouten
ed at FreeBSD.org
Tue Jun 10 20:50:02 UTC 2008
>Number: 124460
>Category: ports
>Synopsis: [Patch] math/calctool: make it use termios
>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: Tue Jun 10 20:50:01 UTC 2008
>Closed-Date:
>Last-Modified:
>Originator: Ed Schouten
>Release: FreeBSD 6.3-STABLE i386
>Organization:
>Environment:
System: FreeBSD palm.hoeg.nl 6.3-STABLE FreeBSD 6.3-STABLE #0: Wed Jun 4 08:56:01 CEST 2008 ed at palm.hoeg.nl:/usr/obj/usr/src/sys/PALM i386
>Description:
The math/calctool port still makes use of the sgtty interface. This
means it only works when one compiles a kernel with COMPAT_43TTY
enabled. We'd better switch to termios. The following patch changes
calctool to use termios instead of sgtty.h.
>How-To-Repeat:
>Fix:
Remove files/patch-aa and save this patch as files/patch-tty.c:
--- tty.c
+++ tty.c
@@ -1,5 +1,3 @@
-/*LINTLIBRARY*/
-
/* @(#)tty.c 1.14 90/02/06
*
* These are the dumb tty dependent graphics routines used by calctool.
@@ -21,6 +19,7 @@
#include <sys/types.h>
#include <sys/ioctl.h>
#include <sys/time.h>
+#include <termios.h>
#include "calctool.h"
#include "color.h"
#include "extern.h"
@@ -30,7 +29,7 @@
char *getenv(), *tgetstr(), *tgoto() ;
int destroy_frame(), outc() ;
-struct sgttyb in_new, in_old ;
+struct termios in_new, in_old ;
SIGRET
@@ -90,7 +89,7 @@
}
do_move(0, 0) ;
SIGNAL(SIGINT, SIG_IGN) ;
- IOCTL(0, TIOCSETP, &in_old) ;
+ tcsetattr(0, TCSANOW, &in_old) ;
exit(0) ;
}
@@ -315,11 +314,14 @@
SIGNAL(SIGINT, cleanup) ;
- IOCTL(0, TIOCGETP, &in_old) ; /* Setup standard input. */
+ tcgetattr(0, &in_old) ; /* Setup standard input. */
in_new = in_old ;
- in_new.sg_flags |= RAW ;
- in_new.sg_flags &= ~(ECHO | CRMOD) ;
- IOCTL(0, TIOCSETP, &in_new) ;
+ in_new.c_iflag |= IGNBRK;
+ in_new.c_iflag &= ~ICRNL;
+ in_new.c_lflag &= ~(ECHOCTL|ISIG|ICANON|IEXTEN);
+ in_new.c_oflag &= ~ONLCR;
+ in_new.c_lflag &= ~ECHO;
+ tcsetattr(0, TCSANOW, &in_new) ;
setbuf(stdout, (char *) NULL) ;
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the freebsd-ports-bugs
mailing list