version 1.16, 2000/04/04 15:19:42 |
version 1.17, 2000/04/04 17:29:46 |
|
|
|
|
/* Initialize select masks. */ |
/* Initialize select masks. */ |
FD_ZERO(readset); |
FD_ZERO(readset); |
|
FD_ZERO(writeset); |
|
|
/* Read from the connection, unless our buffers are full. */ |
|
if (!compat20) { |
if (!compat20) { |
|
/* Read from the connection, unless our buffers are full. */ |
if (buffer_len(&stdout_buffer) < buffer_high && |
if (buffer_len(&stdout_buffer) < buffer_high && |
buffer_len(&stderr_buffer) < buffer_high && |
buffer_len(&stderr_buffer) < buffer_high && |
channel_not_very_much_buffered_data()) |
channel_not_very_much_buffered_data()) |
FD_SET(connection_in, readset); |
FD_SET(connection_in, readset); |
|
/* |
|
* Read from stdin, unless we have seen EOF or have very much |
|
* buffered data to send to the server. |
|
*/ |
|
if (!stdin_eof && packet_not_very_much_data_to_write()) |
|
FD_SET(fileno(stdin), readset); |
|
|
|
/* Select stdout/stderr if have data in buffer. */ |
|
if (buffer_len(&stdout_buffer) > 0) |
|
FD_SET(fileno(stdout), writeset); |
|
if (buffer_len(&stderr_buffer) > 0) |
|
FD_SET(fileno(stderr), writeset); |
} else { |
} else { |
FD_SET(connection_in, readset); |
FD_SET(connection_in, readset); |
} |
} |
|
|
/* |
|
* Read from stdin, unless we have seen EOF or have very much |
|
* buffered data to send to the server. |
|
*/ |
|
if (!compat20) |
|
if (!stdin_eof && packet_not_very_much_data_to_write()) |
|
FD_SET(fileno(stdin), readset); |
|
|
|
FD_ZERO(writeset); |
|
|
|
/* Add any selections by the channel mechanism. */ |
/* Add any selections by the channel mechanism. */ |
channel_prepare_select(readset, writeset); |
channel_prepare_select(readset, writeset); |
|
|
|
|
if (packet_have_data_to_write()) |
if (packet_have_data_to_write()) |
FD_SET(connection_out, writeset); |
FD_SET(connection_out, writeset); |
|
|
if (!compat20) { |
|
/* Select stdout if have data in buffer. */ |
|
if (buffer_len(&stdout_buffer) > 0) |
|
FD_SET(fileno(stdout), writeset); |
|
|
|
/* Select stderr if have data in buffer. */ |
|
if (buffer_len(&stderr_buffer) > 0) |
|
FD_SET(fileno(stderr), writeset); |
|
} |
|
|
|
/* move UP XXX */ |
/* move UP XXX */ |
/* Update maximum file descriptor number, if appropriate. */ |
/* Update maximum file descriptor number, if appropriate. */ |
if (channel_max_fd() > max_fd) |
if (channel_max_fd() > max_fd) |
|
|
} |
} |
|
|
void |
void |
client_process_input(fd_set * readset) |
client_process_net_input(fd_set * readset) |
{ |
{ |
int len, pid; |
int len; |
char buf[8192], *s; |
char buf[8192]; |
|
|
/* |
/* |
* Read input from the server, and add any such data to the buffer of |
* Read input from the server, and add any such data to the buffer of |
|
|
} |
} |
packet_process_incoming(buf, len); |
packet_process_incoming(buf, len); |
} |
} |
|
} |
|
|
if (compat20) |
void |
return; |
client_process_input(fd_set * readset) |
|
{ |
|
int len, pid; |
|
char buf[8192], *s; |
|
|
/* Read input from stdin. */ |
/* Read input from stdin. */ |
if (FD_ISSET(fileno(stdin), readset)) { |
if (FD_ISSET(fileno(stdin), readset)) { |
|
|
enter_raw_mode(); |
enter_raw_mode(); |
|
|
/* Check if we should immediately send of on stdin. */ |
/* Check if we should immediately send of on stdin. */ |
if(!compat20) |
if (!compat20) |
client_check_initial_eof_on_stdin(); |
client_check_initial_eof_on_stdin(); |
|
|
/* Main loop of the client for the interactive session mode. */ |
/* Main loop of the client for the interactive session mode. */ |
|
|
* Make packets of buffered stdin data, and buffer them for |
* Make packets of buffered stdin data, and buffer them for |
* sending to the server. |
* sending to the server. |
*/ |
*/ |
if(!compat20) |
if (!compat20) |
client_make_packets_from_stdin_data(); |
client_make_packets_from_stdin_data(); |
|
|
/* |
/* |
|
|
/* Do channel operations. */ |
/* Do channel operations. */ |
channel_after_select(&readset, &writeset); |
channel_after_select(&readset, &writeset); |
|
|
/* |
/* Buffer input from the connection. */ |
* Process input from the connection and from stdin. Buffer |
client_process_net_input(&readset); |
* any data that is available. |
|
*/ |
|
client_process_input(&readset); |
|
|
|
/* |
if (quit_pending) |
* Process output to stdout and stderr. Output to the |
break; |
* connection is processed elsewhere (above). |
|
*/ |
if (!compat20) { |
if(!compat20) |
/* Buffer data from stdin */ |
|
client_process_input(&readset); |
|
/* |
|
* Process output to stdout and stderr. Output to |
|
* the connection is processed elsewhere (above). |
|
*/ |
client_process_output(&writeset); |
client_process_output(&writeset); |
|
} |
|
|
/* Send as much buffered packet data as possible to the sender. */ |
/* Send as much buffered packet data as possible to the sender. */ |
if (FD_ISSET(connection_out, &writeset)) |
if (FD_ISSET(connection_out, &writeset)) |