aboutsummaryrefslogtreecommitdiff
path: root/examples/sshnetcat.c
diff options
context:
space:
mode:
authorAndreas Schneider <asn@cryptomilk.org>2014-01-16 15:27:46 +0100
committerAndreas Schneider <asn@cryptomilk.org>2014-01-16 15:27:46 +0100
commit2fe59071b242c6104d765b87d99f94bbf377545d (patch)
treece70bfbfc731fa1c14c6e69c40819e4c0d5a7c02 /examples/sshnetcat.c
parenta7157b790714be3a5df112716bfd150ceb99ace7 (diff)
downloadlibssh-2fe59071b242c6104d765b87d99f94bbf377545d.tar.gz
libssh-2fe59071b242c6104d765b87d99f94bbf377545d.tar.xz
libssh-2fe59071b242c6104d765b87d99f94bbf377545d.zip
src: Do not use deprecated functions.
Diffstat (limited to 'examples/sshnetcat.c')
-rw-r--r--examples/sshnetcat.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/examples/sshnetcat.c b/examples/sshnetcat.c
index 67bb1ad6..4ed408da 100644
--- a/examples/sshnetcat.c
+++ b/examples/sshnetcat.c
@@ -102,27 +102,27 @@ static void select_loop(ssh_session session,ssh_channel channel){
if(FD_ISSET(0,&fds)){
lus=read(0,buffer,sizeof(buffer));
if(lus)
- channel_write(channel,buffer,lus);
+ ssh_channel_write(channel,buffer,lus);
else {
eof=1;
- channel_send_eof(channel);
+ ssh_channel_send_eof(channel);
}
}
- if(channel && channel_is_closed(channel)){
- channel_free(channel);
+ if(channel && ssh_channel_is_closed(channel)){
+ ssh_channel_free(channel);
channel=NULL;
channels[0]=NULL;
}
if(outchannels[0]){
- while(channel && channel_is_open(channel) && channel_poll(channel,0)){
- lus=channel_read(channel,buffer,sizeof(buffer),0);
+ while(channel && ssh_channel_is_open(channel) && ssh_channel_poll(channel,0)){
+ lus = ssh_channel_read(channel,buffer,sizeof(buffer),0);
if(lus==-1){
fprintf(stderr, "Error reading channel: %s\n",
ssh_get_error(session));
return;
}
if(lus==0){
- channel_free(channel);
+ ssh_channel_free(channel);
channel=channels[0]=NULL;
} else {
ret = write(1, buffer, lus);
@@ -133,15 +133,15 @@ static void select_loop(ssh_session session,ssh_channel channel){
}
}
}
- while(channel && channel_is_open(channel) && channel_poll(channel,1)){ /* stderr */
- lus=channel_read(channel,buffer,sizeof(buffer),1);
+ while(channel && ssh_channel_is_open(channel) && ssh_channel_poll(channel,1)){ /* stderr */
+ lus = ssh_channel_read(channel, buffer, sizeof(buffer), 1);
if(lus==-1){
fprintf(stderr, "Error reading channel: %s\n",
ssh_get_error(session));
return;
}
if(lus==0){
- channel_free(channel);
+ ssh_channel_free(channel);
channel=channels[0]=NULL;
} else {
ret = write(2, buffer, lus);
@@ -153,8 +153,8 @@ static void select_loop(ssh_session session,ssh_channel channel){
}
}
}
- if(channel && channel_is_closed(channel)){
- channel_free(channel);
+ if(channel && ssh_channel_is_closed(channel)){
+ ssh_channel_free(channel);
channel=NULL;
}
} while (ret==EINTR || ret==SSH_EINTR);
@@ -165,8 +165,8 @@ static void select_loop(ssh_session session,ssh_channel channel){
static void forwarding(ssh_session session){
ssh_channel channel;
int r;
- channel=channel_new(session);
- r=channel_open_forward(channel,desthost,atoi(port),"localhost",22);
+ channel = ssh_channel_new(session);
+ r = ssh_channel_open_forward(channel, desthost, atoi(port), "localhost", 22);
if(r<0) {
printf("error forwarding port : %s\n",ssh_get_error(session));
return;