diff options
Diffstat (limited to 'usr.bin/telnet/sys_bsd.c')
-rw-r--r-- | usr.bin/telnet/sys_bsd.c | 79 |
1 files changed, 66 insertions, 13 deletions
diff --git a/usr.bin/telnet/sys_bsd.c b/usr.bin/telnet/sys_bsd.c index 85414e2..281b8bd 100644 --- a/usr.bin/telnet/sys_bsd.c +++ b/usr.bin/telnet/sys_bsd.c @@ -32,7 +32,7 @@ */ #ifndef lint -static char sccsid[] = "@(#)sys_bsd.c 8.2 (Berkeley) 12/15/93"; +static char sccsid[] = "@(#)sys_bsd.c 8.4 (Berkeley) 5/30/95"; #endif /* not lint */ /* @@ -223,7 +223,7 @@ TerminalSpecialChars(c) /* * Flush output to the terminal */ - + void TerminalFlushOutput() { @@ -328,7 +328,7 @@ TerminalDefaultChars() nttyb.sg_kill = ottyb.sg_kill; nttyb.sg_erase = ottyb.sg_erase; #else /* USE_TERMIO */ - memcpy(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc)); + memmove(new_tc.c_cc, old_tc.c_cc, sizeof(old_tc.c_cc)); # ifndef VDISCARD termFlushChar = CONTROL('O'); # endif @@ -669,7 +669,11 @@ TerminalNewMode(f) #endif #ifdef SIGTSTP (void) signal(SIGTSTP, SIG_DFL); +# ifndef SOLARIS (void) sigsetmask(sigblock(0) & ~(1<<(SIGTSTP-1))); +# else SOLARIS + (void) sigrelse(SIGTSTP); +# endif SOLARIS #endif /* SIGTSTP */ #ifndef USE_TERMIO ltc = oltc; @@ -704,14 +708,51 @@ TerminalNewMode(f) } +/* + * Try to guess whether speeds are "encoded" (4.2BSD) or just numeric (4.4BSD). + */ +#if B4800 != 4800 +#define DECODE_BAUD +#endif + +#ifdef DECODE_BAUD +#ifndef B7200 +#define B7200 B4800 +#endif + +#ifndef B14400 +#define B14400 B9600 +#endif + #ifndef B19200 -# define B19200 B9600 +# define B19200 B14400 +#endif + +#ifndef B28800 +#define B28800 B19200 #endif #ifndef B38400 -# define B38400 B19200 +# define B38400 B28800 #endif +#ifndef B57600 +#define B57600 B38400 +#endif + +#ifndef B76800 +#define B76800 B57600 +#endif + +#ifndef B115200 +#define B115200 B76800 +#endif + +#ifndef B230400 +#define B230400 B115200 +#endif + + /* * This code assumes that the values B0, B50, B75... * are in ascending order. They do not have to be @@ -721,20 +762,25 @@ struct termspeeds { long speed; long value; } termspeeds[] = { - { 0, B0 }, { 50, B50 }, { 75, B75 }, - { 110, B110 }, { 134, B134 }, { 150, B150 }, - { 200, B200 }, { 300, B300 }, { 600, B600 }, - { 1200, B1200 }, { 1800, B1800 }, { 2400, B2400 }, - { 4800, B4800 }, { 9600, B9600 }, { 19200, B19200 }, - { 38400, B38400 }, { -1, B38400 } + { 0, B0 }, { 50, B50 }, { 75, B75 }, + { 110, B110 }, { 134, B134 }, { 150, B150 }, + { 200, B200 }, { 300, B300 }, { 600, B600 }, + { 1200, B1200 }, { 1800, B1800 }, { 2400, B2400 }, + { 4800, B4800 }, { 7200, B7200 }, { 9600, B9600 }, + { 14400, B14400 }, { 19200, B19200 }, { 28800, B28800 }, + { 38400, B38400 }, { 57600, B57600 }, { 115200, B115200 }, + { 230400, B230400 }, { -1, B230400 } }; +#endif /* DECODE_BAUD */ void TerminalSpeeds(ispeed, ospeed) long *ispeed; long *ospeed; { +#ifdef DECODE_BAUD register struct termspeeds *tp; +#endif /* DECODE_BAUD */ register long in, out; out = cfgetospeed(&old_tc); @@ -742,6 +788,7 @@ TerminalSpeeds(ispeed, ospeed) if (in == 0) in = out; +#ifdef DECODE_BAUD tp = termspeeds; while ((tp->speed != -1) && (tp->value < in)) tp++; @@ -751,6 +798,10 @@ TerminalSpeeds(ispeed, ospeed) while ((tp->speed != -1) && (tp->value < out)) tp++; *ospeed = tp->speed; +#else /* DECODE_BAUD */ + *ispeed = in; + *ospeed = out; +#endif /* DECODE_BAUD */ } int @@ -946,7 +997,7 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll) if (netout) { FD_SET(net, &obits); - } + } if (ttyout) { FD_SET(tout, &obits); } @@ -1085,7 +1136,7 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll) int i; i = recv(net, netiring.supply + c, canread - c, MSG_OOB); if (i == c && - bcmp(netiring.supply, netiring.supply + c, i) == 0) { + memcmp(netiring.supply, netiring.supply + c, i) == 0) { bogus_oob = 1; first = 0; } else if (i < 0) { @@ -1134,6 +1185,8 @@ process_rings(netin, netout, netex, ttyin, ttyout, poll) if (FD_ISSET(tin, &ibits)) { FD_CLR(tin, &ibits); c = TerminalRead(ttyiring.supply, ring_empty_consecutive(&ttyiring)); + if (c < 0 && errno == EIO) + c = 0; if (c < 0 && errno == EWOULDBLOCK) { c = 0; } else { |