1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-20 04:28:07 -05:00

Fix a collection of calls to tell_user so that they don't add their

own newline before the one tell_user puts on the end anyway. Also,
while I'm here, make up my mind about whether to prefix messages with
"scp:" or "pscp:" - I choose the latter.

[originally from svn r9914]
This commit is contained in:
Simon Tatham 2013-07-11 17:24:47 +00:00
parent f78c9165a1
commit d9ccf044be

20
pscp.c
View File

@ -526,7 +526,7 @@ static void do_cmd(char *host, char *user, char *cmd)
console_provide_logctx(logctx); console_provide_logctx(logctx);
ssh_scp_init(); ssh_scp_init();
if (verbose && realhost != NULL && errs == 0) if (verbose && realhost != NULL && errs == 0)
tell_user(stderr, "Connected to %s\n", realhost); tell_user(stderr, "Connected to %s", realhost);
sfree(realhost); sfree(realhost);
} }
@ -675,7 +675,7 @@ static int response(void)
} while (p < sizeof(rbuf) && ch != '\n'); } while (p < sizeof(rbuf) && ch != '\n');
rbuf[p - 1] = '\0'; rbuf[p - 1] = '\0';
if (resp == 1) if (resp == 1)
tell_user(stderr, "%s\n", rbuf); tell_user(stderr, "%s", rbuf);
else else
bump("%s", rbuf); bump("%s", rbuf);
errs++; errs++;
@ -927,7 +927,7 @@ int scp_send_filedata(char *data, int len)
pktin = sftp_recv(); pktin = sftp_recv();
ret = xfer_upload_gotpkt(scp_sftp_xfer, pktin); ret = xfer_upload_gotpkt(scp_sftp_xfer, pktin);
if (ret <= 0) { if (ret <= 0) {
tell_user(stderr, "error while writing: %s\n", fxp_error()); tell_user(stderr, "error while writing: %s", fxp_error());
errs++; errs++;
return 1; return 1;
} }
@ -968,7 +968,7 @@ int scp_send_finish(void)
pktin = sftp_recv(); pktin = sftp_recv();
ret = xfer_upload_gotpkt(scp_sftp_xfer, pktin); ret = xfer_upload_gotpkt(scp_sftp_xfer, pktin);
if (ret <= 0) { if (ret <= 0) {
tell_user(stderr, "error while writing: %s\n", fxp_error()); tell_user(stderr, "error while writing: %s", fxp_error());
errs++; errs++;
return 1; return 1;
} }
@ -986,7 +986,7 @@ int scp_send_finish(void)
pktin = sftp_wait_for_reply(req); pktin = sftp_wait_for_reply(req);
ret = fxp_fsetstat_recv(pktin, req); ret = fxp_fsetstat_recv(pktin, req);
if (!ret) { if (!ret) {
tell_user(stderr, "unable to set file times: %s\n", fxp_error()); tell_user(stderr, "unable to set file times: %s", fxp_error());
errs++; errs++;
} }
} }
@ -1328,7 +1328,7 @@ int scp_get_sink_action(struct scp_sink_action *act)
dirhandle = fxp_opendir_recv(pktin, req); dirhandle = fxp_opendir_recv(pktin, req);
if (!dirhandle) { if (!dirhandle) {
tell_user(stderr, "scp: unable to open directory %s: %s", tell_user(stderr, "pscp: unable to open directory %s: %s",
fname, fxp_error()); fname, fxp_error());
if (must_free_fname) sfree(fname); if (must_free_fname) sfree(fname);
errs++; errs++;
@ -1346,7 +1346,7 @@ int scp_get_sink_action(struct scp_sink_action *act)
if (names == NULL) { if (names == NULL) {
if (fxp_error_type() == SSH_FX_EOF) if (fxp_error_type() == SSH_FX_EOF)
break; break;
tell_user(stderr, "scp: reading directory %s: %s\n", tell_user(stderr, "pscp: reading directory %s: %s",
fname, fxp_error()); fname, fxp_error());
req = fxp_close_send(dirhandle); req = fxp_close_send(dirhandle);
@ -1376,7 +1376,7 @@ int scp_get_sink_action(struct scp_sink_action *act)
*/ */
} else if (!vet_filename(names->names[i].filename)) { } else if (!vet_filename(names->names[i].filename)) {
tell_user(stderr, "ignoring potentially dangerous server-" tell_user(stderr, "ignoring potentially dangerous server-"
"supplied filename '%s'\n", "supplied filename '%s'",
names->names[i].filename); names->names[i].filename);
} else } else
ournames[nnames++] = names->names[i]; ournames[nnames++] = names->names[i];
@ -1479,7 +1479,7 @@ int scp_get_sink_action(struct scp_sink_action *act)
act->buf[i - 1] = '\0'; act->buf[i - 1] = '\0';
switch (action) { switch (action) {
case '\01': /* error */ case '\01': /* error */
tell_user(stderr, "%s\n", act->buf); tell_user(stderr, "%s", act->buf);
errs++; errs++;
continue; /* go round again */ continue; /* go round again */
case '\02': /* fatal error */ case '\02': /* fatal error */
@ -1640,7 +1640,7 @@ static void run_err(const char *fmt, ...)
va_start(ap, fmt); va_start(ap, fmt);
errs++; errs++;
str = dupvprintf(fmt, ap); str = dupvprintf(fmt, ap);
str2 = dupcat("scp: ", str, "\n", NULL); str2 = dupcat("pscp: ", str, "\n", NULL);
sfree(str); sfree(str);
scp_send_errmsg(str2); scp_send_errmsg(str2);
tell_user(stderr, "%s", str2); tell_user(stderr, "%s", str2);