*/
#ifndef lint
-static char sccsid[] = "@(#)sys_bsd.c 5.1 (Berkeley) %G%";
+static char sccsid[] = "@(#)sys_bsd.c 5.2 (Berkeley) %G%";
#endif /* not lint */
/*
# ifdef TCSETS
# define TCSANOW TCSETS
# define TCSADRAIN TCSETSW
-# define tcgetattr(f, t) ioctl(f, TCGETS, t)
+# define tcgetattr(f, t) ioctl(f, TCGETS, (char *)t)
# else
# ifdef TCSETA
# define TCSANOW TCSETA
# define TCSADRAIN TCSETAW
-# define tcgetattr(f, t) ioctl(f, TCGETA, t)
+# define tcgetattr(f, t) ioctl(f, TCGETA, (char *)t)
# else
# define TCSANOW TIOCSETA
# define TCSADRAIN TIOCSETAW
-# define tcgetattr(f, t) ioctl(f, TIOCGETA, t)
+# define tcgetattr(f, t) ioctl(f, TIOCGETA, (char *)t)
# endif
# endif
-# define tcsetattr(f, a, t) ioctl(f, a, t)
+# define tcsetattr(f, a, t) ioctl(f, a, (char *)t)
# define cfgetospeed(ptr) ((ptr)->c_cflag&CBAUD)
# ifdef CIBAUD
# define cfgetispeed(ptr) (((ptr)->c_cflag&CIBAUD) >> IBSHIFT)
static fd_set ibits, obits, xbits;
+ void
init_sys()
{
tout = fileno(stdout);
}
+ int
TerminalWrite(buf, n)
-char *buf;
-int n;
+ char *buf;
+ int n;
{
return write(tout, buf, n);
}
+ int
TerminalRead(buf, n)
-char *buf;
-int n;
+ char *buf;
+ int n;
{
return read(tin, buf, n);
}
*
*/
-int
+ int
TerminalAutoFlush()
{
#if defined(LNOFLSH)
* 1 Do add this character
*/
-int
+ int
TerminalSpecialChars(c)
-int c;
+ int c;
{
void xmitAO(), xmitEL(), xmitEC(), intp(), sendbrk();
* Flush output to the terminal
*/
-void
+ void
TerminalFlushOutput()
{
#ifdef TIOCFLUSH
#endif
}
-void
+ void
TerminalSaveState()
{
#ifndef USE_TERMIO
#endif /* USE_TERMIO */
}
-cc_t *
+ cc_t *
tcval(func)
-register int func;
+ register int func;
{
switch(func) {
case SLC_IP: return(&termIntChar);
}
}
-void
+ void
TerminalDefaultChars()
{
#ifndef USE_TERMIO
*/
-void
+ void
TerminalNewMode(f)
-register int f;
+ register int f;
{
static int prevmode = 0;
#ifndef USE_TERMIO
#endif /* USE_TERMIO */
int onoff;
int old;
+ cc_t esc;
globalmode = f&~MODE_FORCE;
if (prevmode == f)
old = ttyflush(SYNCHing|flushout);
if (old < 0 || old > 1) {
#ifdef USE_TERMIO
- tcgetattr(tin, (char *)&tmp_tc);
+ tcgetattr(tin, &tmp_tc);
#endif /* USE_TERMIO */
do {
/*
* Wait for data to drain, then flush again.
*/
#ifdef USE_TERMIO
- tcsetattr(tin, TCSADRAIN, (char *)&tmp_tc);
+ tcsetattr(tin, TCSADRAIN, &tmp_tc);
#endif /* USE_TERMIO */
old = ttyflush(SYNCHing|flushout);
} while (old < 0 || old > 1);
#else
tmp_tc.c_lflag |= ECHO;
tmp_tc.c_oflag |= ONLCR;
-# ifdef notdef
- tmp_tc.c_iflag |= ICRNL;
-# endif
+ if (crlf)
+ tmp_tc.c_iflag |= ICRNL;
#endif
} else {
#ifndef USE_TERMIO
tmp_tc.c_lflag &= ~ECHO;
tmp_tc.c_oflag &= ~ONLCR;
# ifdef notdef
- tmp_tc.c_iflag &= ~ICRNL;
+ if (crlf)
+ tmp_tc.c_iflag &= ~ICRNL;
# endif
#endif
}
if (f&MODE_LIT_ECHO) {
#ifndef USE_TERMIO
- sb.sg_flags &= ~CTLECH;
+ lmode &= ~LCTLECH;
#else
# ifdef ECHOCTL
tmp_tc.c_lflag &= ~ECHOCTL;
#endif
} else {
#ifndef USE_TERMIO
- sb.sg_flags |= CTLECH;
+ lmode |= LCTLECH;
#else
# ifdef ECHOCTL
tmp_tc.c_lflag |= ECHOCTL;
* If the VEOL character is already set, then use VEOL2,
* otherwise use VEOL.
*/
- if ((tmp_tc.c_cc[VEOL] != escape)
+ esc = (rlogin != _POSIX_VDISABLE) ? rlogin : escape;
+ if ((tmp_tc.c_cc[VEOL] != esc)
# ifdef VEOL2
- && (tmp_tc.c_cc[VEOL2] != escape)
+ && (tmp_tc.c_cc[VEOL2] != esc)
# endif
- ) {
+ ) {
if (tmp_tc.c_cc[VEOL] == (cc_t)(_POSIX_VDISABLE))
- tmp_tc.c_cc[VEOL] = escape;
+ tmp_tc.c_cc[VEOL] = esc;
# ifdef VEOL2
else if (tmp_tc.c_cc[VEOL2] == (cc_t)(_POSIX_VDISABLE))
- tmp_tc.c_cc[VEOL2] = escape;
+ tmp_tc.c_cc[VEOL2] = esc;
# endif
}
#else
if (tc.t_brkc == (cc_t)(_POSIX_VDISABLE))
- tc.t_brkc = escape;
+ tc.t_brkc = esc;
#endif
} else {
#ifdef SIGINFO
ioctl(tin, FIOASYNC, (char *)&onoff);
}
#endif /* defined(TN3270) */
+
}
#ifndef B19200
{ 38400, B38400 }, { -1, B38400 }
};
-void
+ void
TerminalSpeeds(ispeed, ospeed)
-long *ispeed;
-long *ospeed;
+ long *ispeed;
+ long *ospeed;
{
register struct termspeeds *tp;
register long in, out;
- in = cfgetispeed(&old_tc);
out = cfgetospeed(&old_tc);
+ in = cfgetispeed(&old_tc);
+ if (in == 0)
+ in = out;
tp = termspeeds;
while ((tp->speed != -1) && (tp->value < in))
*ospeed = tp->speed;
}
-int
+ int
TerminalWindowSize(rows, cols)
-long *rows, *cols;
+ long *rows, *cols;
{
#ifdef TIOCGWINSZ
struct winsize ws;
return 0;
}
-int
+ int
NetClose(fd)
-int fd;
+ int fd;
{
return close(fd);
}
-void
+ void
NetNonblockingIO(fd, onoff)
-int
- fd,
- onoff;
+ int fd;
+ int onoff;
{
ioctl(fd, FIONBIO, (char *)&onoff);
}
#if defined(TN3270)
-void
+ void
NetSigIO(fd, onoff)
-int
- fd,
- onoff;
+ int fd;
+ int onoff;
{
ioctl(fd, FIOASYNC, (char *)&onoff); /* hear about input */
}
-void
+ void
NetSetPgrp(fd)
-int fd;
+ int fd;
{
int myPid;
* Various signal handling routines.
*/
-/* ARGSUSED */
-static SIG_FUNC_RET
+ /* ARGSUSED */
+ static SIG_FUNC_RET
deadpeer(sig)
-int sig;
+ int sig;
{
setcommandmode();
longjmp(peerdied, -1);
}
-/* ARGSUSED */
-static SIG_FUNC_RET
+ /* ARGSUSED */
+ static SIG_FUNC_RET
intr(sig)
-int sig;
+ int sig;
{
if (localchars) {
intp();
longjmp(toplevel, -1);
}
-/* ARGSUSED */
-static SIG_FUNC_RET
+ /* ARGSUSED */
+ static SIG_FUNC_RET
intr2(sig)
-int sig;
+ int sig;
{
if (localchars) {
#ifdef KLUDGELINEMODE
}
#ifdef SIGTSTP
-/* ARGSUSED */
-static SIG_FUNC_RET
+ /* ARGSUSED */
+ static SIG_FUNC_RET
susp(sig)
-int sig;
+ int sig;
{
+ if ((rlogin != _POSIX_VDISABLE) && rlogin_susp())
+ return;
if (localchars)
sendsusp();
}
#endif
#ifdef SIGWINCH
-/* ARGSUSED */
-static SIG_FUNC_RET
+ /* ARGSUSED */
+ static SIG_FUNC_RET
sendwin(sig)
-int sig;
+ int sig;
{
if (connected) {
sendnaws();
#endif
#ifdef SIGINFO
-/* ARGSUSED */
-static SIG_FUNC_RET
+ /* ARGSUSED */
+ static SIG_FUNC_RET
ayt(sig)
-int sig;
+ int sig;
{
if (connected)
sendayt();
#endif
\f
-void
+ void
sys_telnet_init()
{
(void) signal(SIGINT, intr);
* The return value is 1 if something happened, 0 if not.
*/
-int
+ int
process_rings(netin, netout, netex, ttyin, ttyout, poll)
-int poll; /* If 0, then block until something to do */
+ int poll; /* If 0, then block until something to do */
{
register int c;
/* One wants to be a bit careful about setting returnValue