Added TERMIOS support.
This commit is contained in:
parent
16980ff4d4
commit
9eb259ab93
@ -1,8 +1,8 @@
|
||||
# from: @(#)Makefile 5.6 (Berkeley) 3/12/91
|
||||
# $Id: Makefile,v 1.5 1993/11/11 01:30:28 jtc Exp $
|
||||
# $Id: Makefile,v 1.6 1994/04/16 08:14:50 andrew Exp $
|
||||
|
||||
PROG= more
|
||||
CFLAGS+=-I${.CURDIR} -DREGEX
|
||||
CFLAGS+=-I${.CURDIR} -DREGEX -DTERMIOS
|
||||
SRCS= ch.c command.c decode.c filename.c help.c input.c line.c \
|
||||
linenum.c main.c option.c os.c output.c position.c prim.c \
|
||||
screen.c signal.c tags.c ttyin.c
|
||||
|
@ -34,7 +34,7 @@
|
||||
|
||||
#ifndef lint
|
||||
/* from: static char sccsid[] = "@(#)screen.c 5.8 (Berkeley) 6/28/92"; */
|
||||
static char *rcsid = "$Id: screen.c,v 1.2 1993/11/09 05:13:02 cgd Exp $";
|
||||
static char *rcsid = "$Id: screen.c,v 1.3 1994/04/16 08:14:52 andrew Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
@ -47,11 +47,15 @@ static char *rcsid = "$Id: screen.c,v 1.2 1993/11/09 05:13:02 cgd Exp $";
|
||||
#include <stdio.h>
|
||||
#include <less.h>
|
||||
|
||||
#if TERMIO
|
||||
#ifdef TERMIOS
|
||||
#include <termios.h>
|
||||
#else
|
||||
#ifdef TERMIO
|
||||
#include <termio.h>
|
||||
#else
|
||||
#include <sgtty.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TIOCGWINSZ
|
||||
#include <sys/ioctl.h>
|
||||
@ -103,7 +107,11 @@ int so_width, se_width; /* Printing width of standout sequences */
|
||||
* and needed by, the termcap library.
|
||||
* It may be necessary on some systems to declare them extern here.
|
||||
*/
|
||||
#ifdef TERMIOS
|
||||
/*extern*/ speed_t ospeed; /* Terminal output baud rate */
|
||||
#else
|
||||
/*extern*/ short ospeed; /* Terminal output baud rate */
|
||||
#endif
|
||||
/*extern*/ char PC; /* Pad character */
|
||||
|
||||
extern int back_scroll;
|
||||
@ -124,7 +132,50 @@ char *tgoto();
|
||||
raw_mode(on)
|
||||
int on;
|
||||
{
|
||||
#if TERMIO
|
||||
#ifdef TERMIOS
|
||||
struct termios s;
|
||||
static struct termios save_term;
|
||||
|
||||
if (on)
|
||||
{
|
||||
/*
|
||||
* Get terminal modes.
|
||||
*/
|
||||
(void)tcgetattr(2, &s);
|
||||
|
||||
/*
|
||||
* Save modes and set certain variables dependent on modes.
|
||||
*/
|
||||
save_term = s;
|
||||
ospeed = cfgetospeed(&s);
|
||||
erase_char = s.c_cc[VERASE];
|
||||
kill_char = s.c_cc[VKILL];
|
||||
werase_char = s.c_cc[VWERASE];
|
||||
|
||||
/*
|
||||
* Set the modes to the way we want them.
|
||||
*/
|
||||
s.c_lflag &= ~(ICANON|ECHO|ECHOE|ECHOK|ECHONL);
|
||||
s.c_oflag |= (OPOST|ONLCR
|
||||
#ifdef TAB3
|
||||
|TAB3
|
||||
#endif
|
||||
);
|
||||
#ifdef OCRNL
|
||||
s.c_oflag &= ~(OCRNL|ONLRET|ONOCR);
|
||||
#endif
|
||||
s.c_cc[VMIN] = 1;
|
||||
s.c_cc[VTIME] = 0;
|
||||
} else
|
||||
{
|
||||
/*
|
||||
* Restore saved modes.
|
||||
*/
|
||||
s = save_term;
|
||||
}
|
||||
(void)tcsetattr(2, TCSADRAIN, &s);
|
||||
#else
|
||||
#ifdef TERMIO
|
||||
struct termio s;
|
||||
static struct termio save_term;
|
||||
|
||||
@ -196,6 +247,7 @@ raw_mode(on)
|
||||
}
|
||||
(void)ioctl(2, TIOCSETN, &s);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user