Return to BSD News archive
Path: sserve!newshost.anu.edu.au!munnari.oz.au!network.ucsd.edu!library.ucla.edu!agate!howland.reston.ans.net!pipex!zaphod.crihan.fr!univ-lyon1.fr!frmug!renux.frmug.fr.net!keltia.frmug.fr.net!not-for-mail
From: roberto@keltia.frmug.fr.net (Ollivier Robert)
Newsgroups: comp.os.386bsd.questions
Subject: 8-bit clean getty(8) (Was: Re: FreeBSD multiport serial troubles...)
Followup-To: comp.os.386bsd.bugs
Date: 25 Nov 1993 14:43:26 +0100
Organization: Private FreeBSD Usenet Site
Lines: 835
Distribution: world
Message-ID: <2d2cqc$kf@keltia.frmug.fr.net>
References: <CGorE5.23K@swi.psy.uva.nl> <2cglg6$hm@wzv.win.tue.nl> <CGsMxF.3L5@swi.psy.uva.nl> <1993Nov22.031429.27227@mcshub.dcss.mcmaster.ca>
NNTP-Posting-Host: keltia.frmug.fr.net
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
Summary: patch for getty(8)
Keywords: 8bit-cleanness getty hack
[ LONG : contains a patch to getty(8) to support 8 bit clean mode ]
[ followup to c.o.3.bugs ]
In article <1993Nov22.031429.27227@mcshub.dcss.mcmaster.ca>,
Todd Pfaff <todd@flex.eng.mcmaster.ca> wrote:
>Is it login that sets the tty to 7-bit? If so, why? If not, then what's
>the culprit? Is there a simple solution?
The problem lies in getty(8). It is one of the few program in 386/FreeBSD
that remain in old tty mode, using struct sgttyb instead of the POSIX
termios stuff. The old interface is not 8-bit clean and getty is always
setting the port at cs7.
I have an hacked getty (called Ngetty) which has been rewritten with
termios and have no problem whatsoever with incoming calls in 8 bits. It
has been also hacked to support multiple /etc/issue files, one per terminal
line. It works for me since pk0.2.2...
Let me know if it works for you.
My system : FreeBSD keltia 1.0.2 KELTIA#0 i386
Diffs included against FreeBSD 1.0.2 version. They're not very clean but
they do work :-) No warranty of any kind, as always.
------------------------------------------------------------
--- gettytab.h Sat Jun 12 16:54:46 1993
+++ ../Ngetty/gettytab.h Wed Jul 14 21:16:28 1993
@@ -34,6 +34,12 @@
*/
/*
+ Partially hacked by felix@ikf.physik.uni-frankfurt.de.
+ Still undergoing major work. Look out for a new "alpha version
+ coming out! ;-)
+*/
+
+/*
* Getty description definitions.
*/
struct gettystrs {
@@ -85,6 +91,10 @@
#define WE gettystrs[22].value
#define LN gettystrs[23].value
+/* Addition fcb 6/3/93 Support d'une "Issue File" */
+
+#define IF gettystrs[24].value
+
/*
* Numeric definitions.
*/
@@ -104,6 +114,8 @@
#define F2 gettynums[11].value
#define F2set gettynums[11].set
#define PF gettynums[12].value
+#define CSset gettynums[13].set
+#define CS gettynums[13].value
/*
* Boolean values.
@@ -133,6 +145,12 @@
#define AB gettyflags[19].value
#define DX gettyflags[20].value
#define NP gettyflags[21].value
+#define XA gettyflags[22].value
+#define XO gettyflags[23].value
+#define HW gettyflags[24].value
+#define HM gettyflags[25].value
+#define EE gettyflags[26].value
+#define SI gettyflags[27].value
int getent();
long getnum();
--- gettytab.c Mon Nov 1 20:54:38 1993
+++ ../Ngetty/gettytab.c Wed Jul 14 21:16:23 1993
@@ -31,6 +31,12 @@
* SUCH DAMAGE.
*/
+/*
+ Partially hacked by felix@ikf.physik.uni-frankfurt.de.
+ Still undergoing major work. Look out for a new alpha version
+ coming out! ;-)
+*/
+
#ifndef lint
static char sccsid[] = "@(#)gettytab.c 5.5 (Berkeley) 2/25/91";
#endif /* not lint */
@@ -45,9 +51,9 @@
static char *tbuf;
int hopcount; /* detect infinite loops in termcap, init 0 */
-static char *skip();
+char *skip();
char *getstr();
-static char *decode();
+char *decode();
/*
* Get an entry for terminal name in buffer bp,
--- init.c Sat Jun 12 16:54:46 1993
+++ ../Ngetty/init.c Wed Jul 14 21:16:35 1993
@@ -31,6 +31,12 @@
* SUCH DAMAGE.
*/
+/*
+ Partially hacked by felix@ikf.physik.uni-frankfurt.de.
+ Still undergoing major work. Look out for a new alpha version
+ coming out! ;-)
+*/
+
#ifndef lint
static char sccsid[] = "@(#)init.c 5.6 (Berkeley) 3/27/91";
#endif /* not lint */
@@ -40,40 +46,43 @@
*
* Melbourne getty.
*/
-#include <sgtty.h>
+#include <sys/termios.h>
#include "gettytab.h"
#include "pathnames.h"
-extern struct sgttyb tmode;
+/* extern struct sgttyb tmode;
extern struct tchars tc;
-extern struct ltchars ltc;
+extern struct ltchars ltc; */
+extern struct termios tty_mode;
extern char hostname[];
struct gettystrs gettystrs[] = {
- { "nx" }, /* next table */
- { "cl" }, /* screen clear characters */
- { "im" }, /* initial message */
+ { "nx" }, /* next table */
+ { "cl" }, /* screen clear characters */
+ { "im" }, /* initial message */
{ "lm", "login: " }, /* login message */
- { "er", &tmode.sg_erase }, /* erase character */
- { "kl", &tmode.sg_kill }, /* kill character */
- { "et", &tc.t_eofc }, /* eof chatacter (eot) */
- { "pc", "" }, /* pad character */
- { "tt" }, /* terminal type */
- { "ev" }, /* enviroment */
+ { "er", (char *) &(tty_mode.c_cc[VERASE]) }, /* erase character */
+ { "kl", (char *) &(tty_mode.c_cc[VKILL]) }, /* kill character */
+ { "et", (char *) &(tty_mode.c_cc[VEOF]) }, /* eof chatacter (eot) */
+ { "pc", "" }, /* pad character */
+ { "tt" }, /* terminal type */
+ { "ev" }, /* enviroment */
{ "lo", _PATH_LOGIN }, /* login program */
- { "hn", hostname }, /* host name */
- { "he" }, /* host name edit */
- { "in", &tc.t_intrc }, /* interrupt char */
- { "qu", &tc.t_quitc }, /* quit char */
- { "xn", &tc.t_startc }, /* XON (start) char */
- { "xf", &tc.t_stopc }, /* XOFF (stop) char */
- { "bk", &tc.t_brkc }, /* brk char (alt \n) */
- { "su", <c.t_suspc }, /* suspend char */
- { "ds", <c.t_dsuspc }, /* delayed suspend */
- { "rp", <c.t_rprntc }, /* reprint char */
- { "fl", <c.t_flushc }, /* flush output */
- { "we", <c.t_werasc }, /* word erase */
- { "ln", <c.t_lnextc }, /* literal next */
+ { "hn", hostname }, /* host name */
+ { "he" }, /* host name edit */
+ { "in", (char *) &(tty_mode.c_cc[VINTR]) }, /* interrupt char */
+ { "qu", (char *) &(tty_mode.c_cc[VQUIT]) }, /* quit char */
+ { "xn", (char *) &(tty_mode.c_cc[VSTART]) }, /* XON (start) char */
+ { "xf", (char *) &(tty_mode.c_cc[VSTOP]) }, /* XOFF (stop) char */
+ { "bk", (char *) &(tty_mode.c_cc[VDISCARD]) }, /* brk char (alt \n) */
+ { "su", (char *) &(tty_mode.c_cc[VSUSP]) }, /* suspend char */
+ { "ds", (char *) &(tty_mode.c_cc[VDSUSP]) }, /* delayed suspend */
+ { "rp", (char *) &(tty_mode.c_cc[VREPRINT]) }, /* reprint char */
+ { "fl", (char *) &(tty_mode.c_cc[VDISCARD]) }, /* flush output */
+ { "we", (char *) &(tty_mode.c_cc[VWERASE]) }, /* word erase */
+ { "ln", (char *) &(tty_mode.c_cc[VLNEXT]) }, /* literal next */
+/* Addition fcb 6/3/93 */
+ { "if",""}, /* Issue File name */
{ 0 }
};
@@ -91,6 +100,7 @@
{ "f1" }, /* input flags */
{ "f2" }, /* user mode flags */
{ "pf" }, /* delay before flush at 1st prompt */
+ { "cs" },
{ 0 }
};
@@ -117,5 +127,15 @@
{ "ab", 0 }, /* auto-baud detect with '\r' */
{ "dx", 0 }, /* set decctlq */
{ "np", 0 }, /* no parity at all (8bit chars) */
+ { "xa", 0 }, /* no parity at all (8bit chars) */
+ { "xo", 0 }, /* no parity at all (8bit chars) */
+ { "hw", 0 }, /* no parity at all (8bit chars) */
+ { "hm", 0 }, /* no parity at all (8bit chars) */
+ { "ee", 1 }, /* no parity at all (8bit chars) */
+ { "si", 1 }, /* no parity at all (8bit chars) */
{ 0 }
};
+
+
+
+
--- main.c Mon Nov 1 20:54:38 1993
+++ ../Ngetty/main.c Wed Jul 14 21:16:44 1993
@@ -31,6 +31,12 @@
* SUCH DAMAGE.
*/
+/*
+ Partially hacked by felix@ikf.physik.uni-frankfurt.de.
+ Still undergoing major work. Look out for a new alpha version
+ coming out! ;-)
+*/
+
#ifndef lint
char copyright[] =
"@(#) Copyright (c) 1980 The Regents of the University of California.\n\
@@ -41,13 +47,10 @@
static char sccsid[] = "@(#)main.c 5.16 (Berkeley) 3/27/91";
#endif /* not lint */
-#define USE_OLD_TTY
-
#include <sys/param.h>
#include <sys/stat.h>
#include <signal.h>
#include <fcntl.h>
-#include <sgtty.h>
#include <time.h>
#include <ctype.h>
#include <setjmp.h>
@@ -56,20 +59,21 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/termios.h>
#include "gettytab.h"
#include "pathnames.h"
-struct sgttyb tmode = {
- 0, 0, CERASE, CKILL, 0
-};
-struct tchars tc = {
+struct termios tty_mode;
+
+/* struct tchars tc = {
CINTR, CQUIT, CSTART,
CSTOP, CEOF, CBRK,
-};
-struct ltchars ltc = {
+}; */
+/* struct ltchars ltc = {
CSUSP, CDSUSP, CRPRNT,
CFLUSH, CWERASE, CLNEXT
-};
+}; */
int crmod, digit, lower, upper;
@@ -109,9 +113,9 @@
0000,0200,0200,0000,0200,0000,0000,0201
};
-#define ERASE tmode.sg_erase
-#define KILL tmode.sg_kill
-#define EOT tc.t_eofc
+#define ERASE (tty_mode).c_cc[VERASE]
+#define KILL (tty_mode).c_cc[VKILL]
+#define EOT (tty_mode).c_cc[VEOF]
jmp_buf timeout;
@@ -140,12 +144,15 @@
{
extern char **environ;
char *tname;
+ long allflags;
int repcnt = 0;
+ void cat_issue_file();
signal(SIGINT, SIG_IGN);
-/*
signal(SIGQUIT, SIG_DFL);
-*/
+
+ init_charvars(); /* To init the array */
+
openlog("getty", LOG_ODELAY|LOG_CONS, LOG_AUTH);
gethostname(hostname, sizeof(hostname));
if (hostname[0] == '\0')
@@ -190,31 +197,42 @@
if (argc > 1)
tname = argv[1];
for (;;) {
+/* int ldisp = OTTYDISC; */
int off = 0;
- int flushboth = 0;
- struct sgttyb fake;
gettable(tname, tabent, tabstrs);
if (OPset || EPset || APset)
APset++, OPset++, EPset++;
setdefaults();
- ioctl(0, TIOCFLUSH, &flushboth); /* clear out the crap */
- ioctl(0, FIONBIO, &off); /* turn off non-blocking mode */
+ ioctl(0, TIOCFLUSH, 0); /* clear out the crap */
+ ioctl(0, FIONBIO, &off); /* turn off non-blocking mode */
ioctl(0, FIOASYNC, &off); /* ditto for async mode */
- ioctl(0, TIOCGETP, &fake); /* initialize kernel termios */
+ ioctl (0, TIOCGETA, &tty_mode);
if (IS)
- tmode.sg_ispeed = speed(IS);
+ tty_mode.c_ispeed = speed(IS);
else if (SP)
- tmode.sg_ispeed = speed(SP);
+ tty_mode.c_ispeed = speed(SP);
if (OS)
- tmode.sg_ospeed = speed(OS);
+ tty_mode.c_ospeed = speed(OS);
else if (SP)
- tmode.sg_ospeed = speed(SP);
- set_tmode(0);
- setchars();
- ioctl(0, TIOCSETC, &tc);
+ tty_mode.c_ospeed = speed(SP);
+/*
+ if (EC)
+ tty_mode.c_lflag |= ECHO;
+ */
+
+/* if (HC)
+ tty_mode.c_cflag &= ~HUPCL; */
+ /* else */ tty_mode.c_cflag |= HUPCL;
+
+
+ ioctl (0, TIOCSETAW, &tty_mode);
+ setchars(); /* Set special characters */
if (HC)
- ioctl(0, TIOCHPCL, 0);
+ tty_mode.c_cflag &= !HUPCL;
+
+/* ioctl(0, TIOCHPCL, 0); */
+ ioctl(0, FIONCLEX, 0);
if (AB) {
extern char *autobaud();
@@ -231,14 +249,23 @@
if (IM && *IM)
putf(IM);
if (setjmp(timeout)) {
- tmode.sg_ispeed = tmode.sg_ospeed = 0;
- ioctl(0, TIOCSETP, &tmode);
+ tty_mode.c_ispeed = tty_mode.c_ospeed = 0;
+ ioctl(0, TIOCSETA, &tty_mode);
exit(1);
}
if (TO) {
signal(SIGALRM, dingdong);
alarm(TO);
}
+
+/*
+ * fcb 6/3/93
+ * Ajout d\'un fichier genre /etc/issue affiche avant le
+ * login...
+ * Si on en a un a afficher...
+ */
+ if (*(IF)!='\0' ) cat_issue_file();
+
if (getname()) {
register int i;
@@ -251,8 +278,30 @@
}
if (!(upper || lower || digit))
continue;
- set_tmode(2);
- ioctl(0, TIOCSLTC, <c);
+
+
+ setflags(2);
+/* tmode.sg_flags = allflags & 0xffff;
+ allflags >>= 16; */
+ if (crmod || NL)
+ tty_mode.c_oflag |= ONLCR;
+/* if (upper || UC)
+ tmode.sg_flags |= LCASE;
+ if (lower || LC)
+ tmode.sg_flags &= ~LCASE; */
+
+/* fcb 15/03.93 - If we WANT echo, then SET IT!
+ * Fixed ECHO problem: echo should be explicitely set
+ * when necessary. Else we won't have it when entering login name
+ * in case first trial fails.
+ */
+ /* if (EC) */
+ tty_mode.c_lflag |= ECHO;
+
+ ioctl(0, TIOCSETA, &tty_mode);
+
+/* ioctl(0, TIOCSLTC, <c);
+ ioctl(0, TIOCLSET, &allflags); */
signal(SIGINT, SIG_DFL);
for (i = 0; environ[i] != (char *)0; i++)
env[i] = environ[i];
@@ -271,11 +320,11 @@
}
getname()
+
{
register int c;
register char *np;
char cs;
- int flushin = 1 /*FREAD*/;
/*
* Interrupt may happen if we use CBREAK mode
@@ -285,14 +334,16 @@
return (0);
}
signal(SIGINT, interrupt);
- ioctl(0, TIOCFLUSH, &flushin); /* purge any input */
+ setflags(0);
+ ioctl(0, TIOCSETAW, &tty_mode);
+ setflags(1);
prompt();
- oflush();
if (PF > 0) {
+ oflush();
sleep(PF);
PF = 0;
}
- set_tmode(1);
+ ioctl(0, TIOCSETAW, &tty_mode);
crmod = digit = lower = upper = 0;
np = name;
for (;;) {
@@ -301,7 +352,7 @@
exit(0);
if ((c = cs&0177) == 0)
return (0);
- if (c == EOT || c == 4 /*^D*/)
+ if (c == EOT)
exit(1);
if (c == '\r' || c == '\n' || np >= &name[sizeof name]) {
putf("\r\n");
@@ -311,18 +362,19 @@
lower = 1;
else if (isupper(c))
upper = 1;
- else if (c == ERASE || c == '\b' || c == 0177) {
+ else if (c == ERASE || c == '#' || c == '\b') {
if (np > name) {
np--;
- if (tmode.sg_ospeed >= B1200)
+ if (tty_mode.c_ospeed >= B1200)
puts("\b \b");
else
putchr(cs);
}
continue;
- } else if (c == KILL || c == 025 /*^U*/) {
+ } else if (c == KILL || c == '@') {
+ putchr(cs);
putchr('\r');
- if (tmode.sg_ospeed < B1200)
+ if (tty_mode.c_ospeed < B1200)
putchr('\n');
/* this is the way they do it down under ... */
else if (np > name)
@@ -378,8 +430,8 @@
*/
if (pad == 0)
return;
- if (tmode.sg_ospeed <= 0 ||
- tmode.sg_ospeed >= (sizeof tmspc10 / sizeof tmspc10[0]))
+ if (tty_mode.c_ospeed <= 0 ||
+ tty_mode.c_ospeed >= (sizeof tmspc10 / sizeof tmspc10[0]))
return;
/*
@@ -388,7 +440,7 @@
* Transmitting pad characters slows many terminals down and also
* loads the system.
*/
- mspc10 = tmspc10[tmode.sg_ospeed];
+ mspc10 = tmspc10[tty_mode.c_ospeed];
pad += mspc10 / 2;
for (pad /= mspc10; pad > 0; pad--)
putchr(*PC);
@@ -481,28 +533,24 @@
}
}
-/*
- * The conversions from sgttyb to termios make LITOUT and PASS8 affect
- * the parity. So every TIOCSETP ioctl has to be paired with a TIOCLSET
- * ioctl (at least if LITOUT or PASS8 has changed, and PASS8 may vary
- * with 'n').
+/* fcb
+ * Pas elegant, m'enfin...
*/
-set_tmode(n)
- int n;
+
+void cat_issue_file()
{
- long allflags;
+ register int fd, nchars;
+ char tbuf[1];
- allflags = setflags(n);
- tmode.sg_flags = allflags & 0xffff;
- allflags >>= 16;
- if (n == 2) {
- if (crmod || NL)
- tmode.sg_flags |= CRMOD;
- if (upper || UC)
- tmode.sg_flags |= LCASE;
- if (lower || LC)
- tmode.sg_flags &= ~LCASE;
- }
- ioctl(0, TIOCSETP, &tmode);
- ioctl(0, TIOCLSET, &allflags);
+ if (access(IF,R_OK)<0) return;
+ if ((fd = open(IF, O_RDONLY, 0)) < 0) return;
+ while ((nchars = read(fd, tbuf, sizeof(tbuf))) > 0) {
+ if (*tbuf == '\n' ) putchr('\r');
+ putchr(*tbuf);
+ }
+ (void)close(fd);
+ puts("\r\n");
}
+
+
+
--- subr.c Mon Nov 1 20:54:39 1993
+++ ../Ngetty/subr.c Thu Jul 15 20:55:27 1993
@@ -39,6 +39,12 @@
*
*/
+/*
+ Partially hacked by felix@ikf.physik.uni-frankfurt.de.
+ Still undergoing major work. Look out for a new alpha version
+ coming out! ;-)
+*/
+
#ifndef lint
static char sccsid[] = "@(#)subr.c 5.10 (Berkeley) 2/26/91";
#endif /* not lint */
@@ -46,15 +52,18 @@
/*
* Melbourne getty.
*/
-#define USE_OLD_TTY
-#include <sgtty.h>
+/* #define USE_OLD_TTY */
+/* #include <sgtty.h> */
#include <unistd.h>
#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/termios.h>
+#include <syslog.h>
#include "gettytab.h"
-extern struct sgttyb tmode;
-extern struct tchars tc;
-extern struct ltchars ltc;
+extern struct termios tty_mode;
+/* extern struct tchars tc;
+extern struct ltchars ltc; */
/*
* Get a table entry.
@@ -135,14 +144,30 @@
&SU, &DS, &RP, &FL, &WE, &LN, 0
};
-static char *
-charvars[] = {
- &tmode.sg_erase, &tmode.sg_kill, &tc.t_intrc,
- &tc.t_quitc, &tc.t_startc, &tc.t_stopc,
- &tc.t_eofc, &tc.t_brkc, <c.t_suspc,
- <c.t_dsuspc, <c.t_rprntc, <c.t_flushc,
- <c.t_werasc, <c.t_lnextc, 0
-};
+char bla1, bla2, bla3;
+
+char *
+charvars[15];
+
+init_charvars()
+{
+ charvars[0] = (char *) &(tty_mode.c_cc[VERASE]);
+ charvars[1] = (char *) &(tty_mode.c_cc[VKILL]),
+ charvars[2] = (char *) &(tty_mode.c_cc[VINTR]);
+ charvars[3] = (char *) &(tty_mode.c_cc[VQUIT]);
+ charvars[4] = (char *) &(tty_mode.c_cc[VSTART]);
+ charvars[5] = (char *) &(tty_mode.c_cc[VSTOP]);
+ charvars[6] = (char *) &(tty_mode.c_cc[VEOF]);
+ charvars[7] = (char *) /*&(tty_mode.c_cc[tc.t_brkc])*/ &bla1;
+ charvars[8] = (char *) &(tty_mode.c_cc[VSUSP]);
+ charvars[9] = (char *) &(tty_mode.c_cc[VDSUSP]);
+ charvars[10] = (char *) &(tty_mode.c_cc[VREPRINT]);
+ charvars[11] = (char *) &(tty_mode.c_cc[VDISCARD]);
+ /* <c.t_flushc */
+ charvars[12] = (char *) &(tty_mode.c_cc[VWERASE]);
+ charvars[13] = (char *) &(tty_mode.c_cc[VLNEXT]);
+ charvars[14] = (char *) 0;
+}
setchars()
{
@@ -158,59 +183,88 @@
}
}
-long
setflags(n)
+ int n;
{
- register long f;
-
- switch (n) {
- case 0:
- if (F0set)
- return(F0);
- break;
- case 1:
- if (F1set)
- return(F1);
- break;
- default:
- if (F2set)
- return(F2);
- break;
- }
- f = 0;
-
+ tty_mode.c_iflag = tty_mode.c_oflag = tty_mode.c_lflag =
+ tty_mode.c_cflag = 0;
if (AP)
- f |= ANYP;
- else if (OP)
- f |= ODDP;
+ tty_mode.c_cflag |= IGNPAR;
else if (EP)
- f |= EVENP;
- if (NP)
- f |= PASS8;
-
- if (UC)
+ tty_mode.c_cflag |= PARENB;
+ else if (OP)
+ {
+ tty_mode.c_cflag |= PARODD;
+ tty_mode.c_cflag |= PARENB;
+ }
+ if (NP) /* No parity overrides all */
+ {
+ tty_mode.c_cflag &= !PARENB;
+ tty_mode.c_cflag &= !ISTRIP;
+ }
+ switch (CS)
+ {
+ case 5:
+ tty_mode.c_cflag |= CS5;
+ break;
+
+ case 6:
+ tty_mode.c_cflag |= CS6;
+ break;
+
+ case 0:
+ case 7:
+ tty_mode.c_cflag |= CS7;
+ break;
+
+ case 8:
+ tty_mode.c_cflag |= CS8;
+ break;
+
+ default:
+ syslog (LOG_ERR, "%s: %d", "Illegal Character Size", CS);
+ closelog();
+ exit (1);
+ }
+/* if (UC)
f |= LCASE;
-
+*/
if (NL)
- f |= CRMOD;
+ tty_mode.c_iflag |= ICRNL;
+ else
+ tty_mode.c_iflag |= ONLCR;
+ if (XA)
+ tty_mode.c_iflag |= IXANY;
+ if (XO)
+ tty_mode.c_iflag |= (IXON | IXOFF);
+ if (HW)
+ tty_mode.c_cflag |= CRTSCTS;
+ if (HM)
+ tty_mode.c_cflag |= MDMBUF;
+
+/* if (HC)
+ tty_mode.c_cflag &= ~HUPCL; */
+/* else */ tty_mode.c_cflag |= HUPCL;
- f |= delaybits();
+/* f |= delaybits(); */
if (n == 1) { /* read mode flags */
- if (RW)
- f |= RAW;
- else
- f |= CBREAK;
- return (f);
+ if (RW)
+ tty_mode.c_lflag &= !ICANON;
+ else
+ tty_mode.c_lflag |= ICANON;
+ return;
}
- if (!HT)
- f |= XTABS;
+ tty_mode.c_oflag |= OPOST; /* Hard wired */
+/* if (!HT)
+ f |= XTABS;
+*/
if (n == 0)
- return (f);
-
+ return;
+/*
if (CB)
f |= CRTBS;
@@ -222,17 +276,25 @@
if (PE)
f |= PRTERA;
-
+*/
if (EC)
- f |= ECHO;
-
+ tty_mode.c_lflag |= ECHO;
+ if (EE)
+ tty_mode.c_lflag &= !ECHOE;
+ else
+ tty_mode.c_lflag |= ECHOE;
if (XC)
- f |= CTLECH;
+ tty_mode.c_lflag &= !ECHOCTL;
+ if (SI)
+ tty_mode.c_lflag &= !ISIG;
+ else
+ tty_mode.c_lflag |= ISIG;
+
- if (DX)
- f |= DECCTQ;
+/* if (DX)
+ f |= DECCTQ; */
- return (f);
+ return;
}
struct delayval {
@@ -244,7 +306,7 @@
* below are random guesses, I can't be bothered checking
*/
-struct delayval crdelay[] = {
+/* struct delayval crdelay[] = {
1, CR1,
2, CR2,
3, CR3,
@@ -254,8 +316,8 @@
};
struct delayval nldelay[] = {
- 1, NL1, /* special, calculated */
- 2, NL2,
+ 1, NL1, */ /* special, calculated */
+/* 2, NL2,
3, NL3,
100, NL2,
0, NL3,
@@ -275,21 +337,21 @@
struct delayval tbdelay[] = {
1, TAB1,
2, TAB2,
- 3, XTABS, /* this is expand tabs */
- 100, TAB1,
+ 3, XTABS, */ /* this is expand tabs */
+/* 100, TAB1,
0, TAB2,
-};
+}; */
delaybits()
{
register f;
- f = adelay(CD, crdelay);
+/* f = adelay(CD, crdelay);
f |= adelay(ND, nldelay);
f |= adelay(FD, ffdelay);
f |= adelay(TD, tbdelay);
- f |= adelay(BD, bsdelay);
- return (f);
+ f |= adelay(BD, bsdelay);
+ return (f); */
}
adelay(ms, dp)
------------------------------------------------------------
--
Ollivier ROBERT Ollivier.Robert@keltia.frmug.fr.net
A FreeBSD & PERL addict... PGP 2.3a Public Key on request