Use the same DECODE_BAUD trick like in new telnetd to obtain

termios speed.
Obtained from: Pre-Lite2 telnet
This commit is contained in:
Andrey A. Chernov 1995-08-02 11:20:05 +00:00
parent b418143d61
commit 955db62afa
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=9857

View File

@ -949,6 +949,14 @@ tty_iscrnl()
#endif
}
/*
* Try to guess whether speeds are "encoded" (4.2BSD) or just numeric (4.4BSD).
*/
#if B4800 != 4800
#define DECODE_BAUD
#endif
#ifdef DECODE_BAUD
/*
* A table of available terminal speeds
*/
@ -963,27 +971,36 @@ struct termspeeds {
{ 4800, B4800 }, { 9600, B9600 }, { 19200, B9600 },
{ 38400, B9600 }, { -1, B9600 }
};
#endif /* DECODE_BUAD */
void
tty_tspeed(val)
int val;
{
#ifdef DECODE_BAUD
register struct termspeeds *tp;
for (tp = termspeeds; (tp->speed != -1) && (val > tp->speed); tp++)
;
cfsetospeed(&termbuf, tp->value);
#else /* DECODE_BUAD */
cfsetospeed(&termbuf, val);
#endif /* DECODE_BUAD */
}
void
tty_rspeed(val)
int val;
{
#ifdef DECODE_BAUD
register struct termspeeds *tp;
for (tp = termspeeds; (tp->speed != -1) && (val > tp->speed); tp++)
;
cfsetispeed(&termbuf, tp->value);
#else /* DECODE_BAUD */
cfsetispeed(&termbuf, val);
#endif /* DECODE_BAUD */
}
#if defined(CRAY2) && defined(UNICOS5)