extern int errno; /* outside this world */
extern int
- SYNCHing, /* we are in TELNET SYNCH mode */
flushout, /* flush output */
connected, /* Are we connected to the other side? */
globalmode, /* Mode tty should be in */
localchars, /* we recognize interrupt/quit */
donelclchars, /* the user has set "localchars" */
showoptions,
- flushline,
net,
tin,
tout,
}
+/*
+ * setneturg()
+ *
+ * Sets "neturg" to the current location.
+ */
+
+void
+setneturg()
+{
+ neturg = NETLOC()-1; /* Some systems are off by one XXX */
+}
+
+
/*
* netflush
* Send as much data as possible to the network,
* us in any case.
*/
-static void
+void
netclear()
{
register char *thisitem, *next;
nfrontp = good; /* next byte to be sent */
neturg = 0;
}
-\f
-/*
- * These routines add various telnet commands to the data stream.
- */
-
-void
-xmitAO()
-{
- NET2ADD(IAC, AO);
- if (autoflush) {
- doflush();
- }
-}
-
-
-void
-xmitEL()
-{
- NET2ADD(IAC, EL);
-}
-
-void
-xmitEC()
-{
- NET2ADD(IAC, EC);
-}
-
-
-#if defined(NOT43)
-int
-#else /* defined(NOT43) */
-void
-#endif /* defined(NOT43) */
-dosynch()
-{
- netclear(); /* clear the path to the network */
- NET2ADD(IAC, DM);
- neturg = NETLOC()-1; /* Some systems are off by one XXX */
-
-#if defined(NOT43)
- return 0;
-#endif /* defined(NOT43) */
-}
-
-void
-doflush()
-{
- NET2ADD(IAC, DO);
- NETADD(TELOPT_TM);
- flushline = 1;
- flushout = 1;
- ttyflush();
- /* do printoption AFTER flush, otherwise the output gets tossed... */
- printoption("<SENT", doopt, TELOPT_TM, 0);
-}
-
-void
-intp()
-{
- NET2ADD(IAC, IP);
- if (autoflush) {
- doflush();
- }
- if (autosynch) {
- dosynch();
- }
-}
-
-void
-sendbrk()
-{
- NET2ADD(IAC, BREAK);
- if (autoflush) {
- doflush();
- }
- if (autosynch) {
- dosynch();
- }
-}
int
-ttyflush()
+ttyflush(drop)
+int drop;
{
int n;
if ((n = tfrontp - tbackp) > 0) {
- if (!(SYNCHing||flushout)) {
- n = TerminalWrite(tout, tbackp, n);
- } else {
+ if (drop) {
TerminalFlushOutput();
/* we leave 'n' alone! */
+ } else {
+ n = TerminalWrite(tout, tbackp, n);
}
}
if (n >= 0) {
void
outputPurge()
{
- int tmp = flushout;
-
- flushout = 1;
-
- ttyflush();
-
- flushout = tmp;
+ ttyflush(1);
}
while (count) {
if (tfrontp >= ttyobuf+sizeof ttyobuf) {
- ttyflush();
+ ttyflush(0);
while (tfrontp >= ttyobuf+sizeof ttyobuf) {
#if defined(unix)
FD_SET(tout, &o);
(void) select(tout+1, (fd_set *) 0, &o, (fd_set *) 0,
(struct timeval *) 0);
#endif /* defined(unix) */
- ttyflush();
+ ttyflush(0);
}
}
*tfrontp++ = *buffer++;
#endif /* defined(unix) */
} else {
while (tfrontp != tbackp) {
- ttyflush();
+ ttyflush(0);
#if defined(unix)
FD_SET(tout, &o);
(void) select(tout+1, (int *) 0, &o, (int *) 0,