static void rsource(char *src);
static void sink(char *targ, char *src);
+const char *const appname = "PSCP";
+
/*
* The maximum amount of queued data we accept before we stop and
* wait for the server to process some.
*/
if (is_stderr) {
if (len > 0)
- fwrite(data, 1, len, stderr);
+ if (fwrite(data, 1, len, stderr) < len)
+ /* oh well */;
return 0;
}
- /*
- * If this is before the real session begins, just return.
- */
- if (!outptr)
- return 0;
-
if ((outlen > 0) && (len > 0)) {
unsigned used = outlen;
if (used > len)
}
while (outlen > 0) {
- if (ssh_sftp_loop_iteration() < 0)
+ if (back->exitcode(backhandle) >= 0 || ssh_sftp_loop_iteration() < 0)
return 0; /* doom */
}
static void ssh_scp_init(void)
{
while (!back->sendok(backhandle)) {
- if (ssh_sftp_loop_iteration() < 0)
+ if (back->exitcode(backhandle) >= 0) {
+ errs++;
+ return;
+ }
+ if (ssh_sftp_loop_iteration() < 0) {
+ errs++;
return; /* doom */
+ }
}
/* Work out which backend we ended up using. */
sfree(str2);
errs++;
- if (back != NULL && back->socket(backhandle) != NULL) {
+ if (back != NULL && back->connected(backhandle)) {
char ch;
back->special(backhandle, TS_EOF);
ssh_scp_recv((unsigned char *) &ch, 1);
cfg.x11_forward = 0;
cfg.agentfwd = 0;
cfg.portfwd[0] = cfg.portfwd[1] = '\0';
+ cfg.ssh_simple = TRUE;
/*
* Set up main and possibly fallback command depending on
back->provide_logctx(backhandle, logctx);
console_provide_logctx(logctx);
ssh_scp_init();
- if (verbose && realhost != NULL)
+ if (verbose && realhost != NULL && errs == 0)
tell_user(stderr, "Connected to %s\n", realhost);
sfree(realhost);
}
host = src;
src = colon(src);
if (src == NULL)
- bump("Local to local copy not supported");
+ bump("Local file listing not supported");
*src++ = '\0';
if (*src == '\0')
src = ".";
tolocal(argc, argv);
}
- if (back != NULL && back->socket(backhandle) != NULL) {
+ if (back != NULL && back->connected(backhandle)) {
char ch;
back->special(backhandle, TS_EOF);
ssh_scp_recv((unsigned char *) &ch, 1);