diff options
Diffstat (limited to 'sftp.c')
-rw-r--r-- | sftp.c | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #include "includes.h" | 25 | #include "includes.h" |
26 | 26 | ||
27 | RCSID("$OpenBSD: sftp.c,v 1.31 2002/07/25 01:16:59 mouring Exp $"); | 27 | RCSID("$OpenBSD: sftp.c,v 1.34 2003/01/10 08:19:07 fgsch Exp $"); |
28 | 28 | ||
29 | /* XXX: short-form remote directory listings (like 'ls -C') */ | 29 | /* XXX: short-form remote directory listings (like 'ls -C') */ |
30 | 30 | ||
@@ -49,6 +49,8 @@ FILE* infile; | |||
49 | size_t copy_buffer_len = 32768; | 49 | size_t copy_buffer_len = 32768; |
50 | size_t num_requests = 16; | 50 | size_t num_requests = 16; |
51 | 51 | ||
52 | extern int showprogress; | ||
53 | |||
52 | static void | 54 | static void |
53 | connect_to_server(char *path, char **args, int *in, int *out, pid_t *sshpid) | 55 | connect_to_server(char *path, char **args, int *in, int *out, pid_t *sshpid) |
54 | { | 56 | { |
@@ -108,7 +110,7 @@ usage(void) | |||
108 | int | 110 | int |
109 | main(int argc, char **argv) | 111 | main(int argc, char **argv) |
110 | { | 112 | { |
111 | int in, out, ch; | 113 | int in, out, ch, err; |
112 | pid_t sshpid; | 114 | pid_t sshpid; |
113 | char *host, *userhost, *cp, *file2; | 115 | char *host, *userhost, *cp, *file2; |
114 | int debug_level = 0, sshver = 2; | 116 | int debug_level = 0, sshver = 2; |
@@ -162,6 +164,7 @@ main(int argc, char **argv) | |||
162 | fatal("%s (%s).", strerror(errno), optarg); | 164 | fatal("%s (%s).", strerror(errno), optarg); |
163 | } else | 165 | } else |
164 | fatal("Filename already specified."); | 166 | fatal("Filename already specified."); |
167 | showprogress = 0; | ||
165 | break; | 168 | break; |
166 | case 'P': | 169 | case 'P': |
167 | sftp_direct = optarg; | 170 | sftp_direct = optarg; |
@@ -197,7 +200,7 @@ main(int argc, char **argv) | |||
197 | file1 = cp; | 200 | file1 = cp; |
198 | } | 201 | } |
199 | 202 | ||
200 | if ((host = strchr(userhost, '@')) == NULL) | 203 | if ((host = strrchr(userhost, '@')) == NULL) |
201 | host = userhost; | 204 | host = userhost; |
202 | else { | 205 | else { |
203 | *host++ = '\0'; | 206 | *host++ = '\0'; |
@@ -237,7 +240,7 @@ main(int argc, char **argv) | |||
237 | &sshpid); | 240 | &sshpid); |
238 | } | 241 | } |
239 | 242 | ||
240 | interactive_loop(in, out, file1, file2); | 243 | err = interactive_loop(in, out, file1, file2); |
241 | 244 | ||
242 | #if !defined(USE_PIPES) | 245 | #if !defined(USE_PIPES) |
243 | shutdown(in, SHUT_RDWR); | 246 | shutdown(in, SHUT_RDWR); |
@@ -254,5 +257,5 @@ main(int argc, char **argv) | |||
254 | fatal("Couldn't wait for ssh process: %s", | 257 | fatal("Couldn't wait for ssh process: %s", |
255 | strerror(errno)); | 258 | strerror(errno)); |
256 | 259 | ||
257 | exit(0); | 260 | exit(err == 0 ? 0 : 1); |
258 | } | 261 | } |