Implement channel_read() as a POSIX like function.

Create channel_read_buffer() to have the old version still available.


git-svn-id: svn+ssh://svn.berlios.de/svnroot/repos/libssh/trunk@700 7dcaeef0-15fb-0310-b436-a5af3365683c
This commit is contained in:
Andreas Schneider
2009-05-04 10:06:49 +00:00
parent dda7808851
commit 152da07023
6 changed files with 247 additions and 125 deletions

View File

@@ -188,7 +188,7 @@ static void select_loop(SSH_SESSION *session,CHANNEL *channel){
}
if(channels[0]){
while(channel && channel_is_open(channel) && channel_poll(channel,0)){
lus=channel_read(channel,readbuf,0,0);
lus=channel_read_buffer(channel,readbuf,0,0);
if(lus==-1){
fprintf(stderr, "Error reading channel: %s\n",
ssh_get_error(session));
@@ -204,7 +204,7 @@ static void select_loop(SSH_SESSION *session,CHANNEL *channel){
write(1,buffer_get(readbuf),lus);
}
while(channel && channel_is_open(channel) && channel_poll(channel,1)){ /* stderr */
lus=channel_read(channel,readbuf,0,1);
lus=channel_read_buffer(channel,readbuf,0,1);
if(lus==-1){
fprintf(stderr, "Error reading channel: %s\n",
ssh_get_error(session));