Bug 124460

Summary: [Patch] math/calctool: make it use termios
Product: Ports & Packages Reporter: Ed Schouten <ed>
Component: Individual Port(s)Assignee: Stanislav Sedov <stas>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   

Description Ed Schouten freebsd_committer freebsd_triage 2008-06-10 21:50:01 UTC
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.

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) ;
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2008-06-10 21:50:09 UTC
Responsible Changed
From-To: freebsd-ports-bugs->stas

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2008-06-14 15:15:09 UTC
stas        2008-06-14 14:14:58 UTC

  FreeBSD ports repository

  Modified files:
    math/calctool        Makefile 
  Added files:
    math/calctool/files  patch-tty.c 
  Removed files:
    math/calctool/files  patch-aa 
  Log:
  - Eliminate sgtty dependency.
  - Bump PORTREVISION.
  
  PR:                     ports/124460
  Submitted by:           ed@
  
  Revision  Changes    Path
  1.21      +1 -1      ports/math/calctool/Makefile
  1.2       +0 -22     ports/math/calctool/files/patch-aa (dead)
  1.1       +47 -0     ports/math/calctool/files/patch-tty.c (new)
_______________________________________________
cvs-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/cvs-all
To unsubscribe, send any mail to "cvs-all-unsubscribe@freebsd.org"
Comment 3 Stanislav Sedov freebsd_committer freebsd_triage 2008-06-14 15:15:59 UTC
State Changed
From-To: open->closed

Committed. Thanks!