diff --git a/examples/libssh_scp.c b/examples/libssh_scp.c index 5d92e3c6..83e60b53 100644 --- a/examples/libssh_scp.c +++ b/examples/libssh_scp.c @@ -175,6 +175,7 @@ static int do_copy(struct location *src, struct location *dest, int recursive){ int total=0; int mode; char *filename; + /* recursive mode doesn't work yet */ (void)recursive; /* Get the file name and size*/ if(!src->is_ssh){ @@ -263,7 +264,28 @@ static int do_copy(struct location *src, struct location *dest, int recursive){ total+=r; } while(total < size); - printf("wrote %d bytes\n",total); + printf("wrote %d bytes\n",total); + return 0; +} + +int main(int argc, char **argv){ + struct location *dest, *src; + int i; + int r; + if(opts(argc,argv)<0) + return EXIT_FAILURE; + dest=parse_location(destination); + if(open_location(dest,WRITE)<0) + return EXIT_FAILURE; + for(i=0;iis_ssh){ r=ssh_scp_close(dest->scp); if(r == SSH_ERROR){ @@ -276,29 +298,6 @@ static int do_copy(struct location *src, struct location *dest, int recursive){ fclose(dest->file); dest->file=NULL; } - return 0; -} - -int main(int argc, char **argv){ - struct location *dest, *src; - int i; - - if(opts(argc,argv)<0) - return EXIT_FAILURE; - dest=parse_location(destination); - if(open_location(dest,WRITE)<0) - return EXIT_FAILURE; - for(i=0;isession); ssh_finalize(); return 0;