version 1.34, 2017/07/19 12:25:52 |
version 1.35, 2019/06/28 13:35:04 |
|
|
sigprocmask(SIG_UNBLOCK, &mask, NULL); |
sigprocmask(SIG_UNBLOCK, &mask, NULL); |
tmp_tc = old_tc; |
tmp_tc = old_tc; |
} |
} |
if (isatty(tin) && tcsetattr(tin, TCSADRAIN, &tmp_tc) < 0) |
if (isatty(tin) && tcsetattr(tin, TCSADRAIN, &tmp_tc) == -1) |
tcsetattr(tin, TCSANOW, &tmp_tc); |
tcsetattr(tin, TCSANOW, &tmp_tc); |
|
|
ioctl(tin, FIONBIO, &onoff); |
ioctl(tin, FIONBIO, &onoff); |
|
|
{ |
{ |
struct winsize ws; |
struct winsize ws; |
|
|
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) >= 0) { |
if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) == 0) { |
*rows = ws.ws_row; |
*rows = ws.ws_row; |
*cols = ws.ws_col; |
*cols = ws.ws_col; |
return 1; |
return 1; |
|
|
pfd[TELNET_FD_NET].fd = -1; |
pfd[TELNET_FD_NET].fd = -1; |
} |
} |
|
|
if ((c = poll(pfd, TELNET_FD_NUM, dopoll ? 0 : INFTIM)) < 0) { |
if ((c = poll(pfd, TELNET_FD_NUM, dopoll ? 0 : INFTIM)) == -1) { |
return 0; |
return 0; |
} |
} |
|
|
|
|
|
|
canread = ring_empty_consecutive(&netiring); |
canread = ring_empty_consecutive(&netiring); |
c = recv(net, netiring.supply, canread, 0); |
c = recv(net, netiring.supply, canread, 0); |
if (c < 0 && errno == EWOULDBLOCK) { |
if (c == -1 && errno == EWOULDBLOCK) { |
c = 0; |
c = 0; |
} else if (c <= 0) { |
} else if (c <= 0) { |
return -1; |
return -1; |
|
|
*/ |
*/ |
if (pfd[TELNET_FD_TIN].revents & (POLLIN|POLLHUP)) { |
if (pfd[TELNET_FD_TIN].revents & (POLLIN|POLLHUP)) { |
c = read(tin, ttyiring.supply, ring_empty_consecutive(&ttyiring)); |
c = read(tin, ttyiring.supply, ring_empty_consecutive(&ttyiring)); |
if (c < 0 && errno == EIO) |
if (c == -1 && errno == EIO) |
c = 0; |
c = 0; |
if (c < 0 && errno == EWOULDBLOCK) { |
if (c == -1 && errno == EWOULDBLOCK) { |
c = 0; |
c = 0; |
} else { |
} else { |
/* EOF detection for line mode!!!! */ |
/* EOF detection for line mode!!!! */ |