- Use termios.h instead of sgtty.h

PR:		119103
Submitted by:	Ed Schouten <ed@fxq.nl>
Approved by:	maintainer timeout
This commit is contained in:
Martin Wilke 2008-01-21 12:59:07 +00:00
parent 85da96556f
commit 602264d818
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=205979
2 changed files with 94 additions and 17 deletions

View File

@ -1,23 +1,21 @@
--- main.c.orig Thu Mar 25 11:26:53 1999
+++ main.c Tue Sep 26 17:27:58 2000
@@ -18,6 +18,7 @@
#include <signal.h>
#include "tintin.h"
#include <fcntl.h>
+#include <termios.h>
@@ -100,12 +100,8 @@
extern void term_echo();
#ifndef BADSIG
#define BADSIG (void (*)())-1
@@ -109,7 +110,7 @@
int last_line_length;
-#if defined(HAVE_SYS_TERMIO_H) && !defined(BSD_ECHO) || defined(HAVE_TERMIO_H)
-#if defined(HAVE_SYS_TERMIO_H)
-#include <sys/termio.h>
-#else
-#include <termio.h>
-#endif
+#if 1
+#include <termios.h>
tcflag_t c_lflag;
cc_t c_cc[NCCS];
#else
-unsigned char c_cc[NCC];
+unsigned char c_cc[NCCS];
unsigned short c_lflag;
#endif
@@ -580,7 +581,7 @@
@@ -580,7 +576,7 @@
if(ses->logfile) {
if (!OLD_LOG) {
count=0;
@ -26,7 +24,7 @@
if (buffer[n]!='\r') {
temp[count]=buffer[n];
count++;
@@ -750,7 +751,7 @@
@@ -750,7 +746,7 @@
sprintf(strng,"%c8%s\n\r%c7%c[%d;%df", E, cptr, E, E, input_row, input_col);
else
sprintf(strng,"%s\n\r", cptr);
@ -35,7 +33,7 @@
display_col=1;
if (redraw && term_echoing && !is_split)
write(1, k_input, strlen(k_input));
@@ -806,7 +807,7 @@
@@ -806,7 +802,7 @@
cptr++;
sprintf(strng,"%s\n\r", cptr);
}
@ -44,7 +42,7 @@
display_col=1;
}
text_came=TRUE;
@@ -876,7 +877,7 @@
@@ -876,7 +872,7 @@
input_col=1;
sprintf(fn, "%c[2J%c[1;%dr%c[%d;1f", E, E, display_row, E, split_line);
write(1,fn, strlen(fn));

View File

@ -0,0 +1,79 @@
--- echo.c 1999-03-04 19:23:42.000000000 +0100
+++ echo.c 2007-12-28 15:23:31.000000000 +0100
@@ -18,12 +18,8 @@
#include <sys/ioctl.h>
#endif
-#if defined(HAVE_SYS_TERMIO_H) && !defined(BSD_ECHO) || defined(HAVE_TERMIO_H)
-#if defined(HAVE_SYS_TERMIO_H)
-#include <sys/termio.h>
-#else
-#include <termio.h>
-#endif
+#if 1
+#include <termios.h>
#else
#include <sgtty.h>
#if DIRTY_REDEFINE
@@ -34,8 +30,8 @@
#endif
#endif
-#if defined(HAVE_SYS_TERMIO_H) && !defined(BSD_ECHO) || defined(HAVE_TERMIO_H)
-#ifdef HAVE_TCFLAG_T
+#if 1
+#if 1
extern tcflag_t c_lflag;
extern cc_t c_cc[NCCS];
#else
@@ -44,10 +40,10 @@
#endif
void init_echo()
{
- struct termio io;
+ struct termios io;
- if(ioctl(0, TCGETA, &io)<0)
- syserr("ioctl");
+ if(tcgetattr(0, &io)<0)
+ syserr("tcgetattr");
c_lflag = io.c_lflag;
c_cc[VMIN] = io.c_cc[VMIN];
c_cc[VTIME] = io.c_cc[VTIME];
@@ -58,14 +54,14 @@
/********************************/
void term_echo()
{
- struct termio io;
+ struct termios io;
- if(ioctl(0, TCGETA, &io)<0)
+ if(tcgetattr(0, &io)<0)
syserr("ioctl");
io.c_lflag = c_lflag;
io.c_cc[VMIN] = c_cc[VMIN];
io.c_cc[VTIME] = c_cc[VTIME];
- if(ioctl(0, TCSETA, &io)<0)
+ if(tcsetattr(0, TCSANOW, &io)<0)
syserr("ioctl");
}
@@ -74,15 +70,15 @@
/*********************************/
void term_noecho()
{
- struct termio io;
+ struct termios io;
- if(ioctl(0, TCGETA, &io)<0)
+ if(tcgetattr(0, &io)<0)
syserr("ioctl");
io.c_lflag &= ~ECHO;
io.c_lflag &= ~ICANON;
io.c_cc[VMIN]=1;
io.c_cc[VTIME]=0;
- if(ioctl(0, TCSETA, &io) < 0)
+ if(tcsetattr(0, TCSANOW, &io) < 0)
syserr("ioctl");
}