version 1.18, 2014/07/20 06:39:41 |
version 1.19, 2014/07/20 07:35:04 |
|
|
} |
} |
|
|
|
|
int |
|
TerminalWrite(buf, n) |
|
char *buf; |
|
int n; |
|
{ |
|
return write(tout, buf, n); |
|
} |
|
|
|
int |
|
TerminalRead(buf, n) |
|
unsigned char *buf; |
|
int n; |
|
{ |
|
return read(tin, buf, n); |
|
} |
|
|
|
/* |
|
* |
|
*/ |
|
|
|
int |
|
TerminalAutoFlush() |
|
{ |
|
#if defined(LNOFLSH) |
|
int flush; |
|
|
|
ioctl(0, TIOCLGET, (char *)&flush); |
|
return !(flush&LNOFLSH); /* if LNOFLSH, no autoflush */ |
|
#else /* LNOFLSH */ |
|
return 1; |
|
#endif /* LNOFLSH */ |
|
} |
|
|
|
#ifdef KLUDGELINEMODE |
#ifdef KLUDGELINEMODE |
extern int kludgelinemode; |
extern int kludgelinemode; |
#endif |
#endif |
|
|
return 1; |
return 1; |
} |
} |
|
|
|
|
/* |
|
* Flush output to the terminal |
|
*/ |
|
|
|
void |
void |
TerminalFlushOutput() |
|
{ |
|
#ifdef TIOCFLUSH |
|
int com = FWRITE; |
|
(void) ioctl(fileno(stdout), TIOCFLUSH, (int *) &com); |
|
#else |
|
(void) ioctl(fileno(stdout), TCFLSH, (int *) 0); |
|
#endif |
|
} |
|
|
|
void |
|
TerminalSaveState() |
TerminalSaveState() |
{ |
{ |
tcgetattr(0, &old_tc); |
tcgetattr(0, &old_tc); |
|
|
* Something to read from the tty... |
* Something to read from the tty... |
*/ |
*/ |
if (pfd[TELNET_FD_TIN].revents & (POLLIN|POLLHUP)) { |
if (pfd[TELNET_FD_TIN].revents & (POLLIN|POLLHUP)) { |
c = TerminalRead(ttyiring.supply, ring_empty_consecutive(&ttyiring)); |
c = read(tin, ttyiring.supply, ring_empty_consecutive(&ttyiring)); |
if (c < 0 && errno == EIO) |
if (c < 0 && errno == EIO) |
c = 0; |
c = 0; |
if (c < 0 && errno == EWOULDBLOCK) { |
if (c < 0 && errno == EWOULDBLOCK) { |