X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/514702987c9252fcb0ab98882a6603b3bd0505ce..eec8f73c747cbb8e32f825ee48f29e34e8cd14b8:/psftp.c diff --git a/psftp.c b/psftp.c index a278260b..8ed4e20e 100644 --- a/psftp.c +++ b/psftp.c @@ -32,6 +32,8 @@ static int do_sftp_init(void); */ char *pwd, *homedir; +static Backend *back; +static void *backhandle; /* ---------------------------------------------------------------------- * Higher-level helper functions used in commands. @@ -1446,45 +1448,48 @@ static int verbose = 0; */ void fatalbox(char *fmt, ...) { - char str[0x100]; /* Make the size big enough */ + char *str, *str2; va_list ap; va_start(ap, fmt); - strcpy(str, "Fatal:"); - vsprintf(str + strlen(str), fmt, ap); + str = dupvprintf(fmt, ap); + str2 = dupcat("Fatal: ", str, "\n", NULL); + sfree(str); va_end(ap); - strcat(str, "\n"); - fputs(str, stderr); + fputs(str2, stderr); + sfree(str2); cleanup_exit(1); } void modalfatalbox(char *fmt, ...) { - char str[0x100]; /* Make the size big enough */ + char *str, *str2; va_list ap; va_start(ap, fmt); - strcpy(str, "Fatal:"); - vsprintf(str + strlen(str), fmt, ap); + str = dupvprintf(fmt, ap); + str2 = dupcat("Fatal: ", str, "\n", NULL); + sfree(str); va_end(ap); - strcat(str, "\n"); - fputs(str, stderr); + fputs(str2, stderr); + sfree(str2); cleanup_exit(1); } -void connection_fatal(char *fmt, ...) +void connection_fatal(void *frontend, char *fmt, ...) { - char str[0x100]; /* Make the size big enough */ + char *str, *str2; va_list ap; va_start(ap, fmt); - strcpy(str, "Fatal:"); - vsprintf(str + strlen(str), fmt, ap); + str = dupvprintf(fmt, ap); + str2 = dupcat("Fatal: ", str, "\n", NULL); + sfree(str); va_end(ap); - strcat(str, "\n"); - fputs(str, stderr); + fputs(str2, stderr); + sfree(str2); cleanup_exit(1); } -void ldisc_send(char *buf, int len, int interactive) +void ldisc_send(void *handle, char *buf, int len, int interactive) { /* * This is only here because of the calls to ldisc_send(NULL, @@ -1767,6 +1772,7 @@ static int psftp_connect(char *userhost, char *user, int portnumber) } if (!cfg.username[0]) { printf("login as: "); + fflush(stdout); if (!fgets(cfg.username, sizeof(cfg.username), stdin)) { fprintf(stderr, "psftp: aborting\n"); cleanup_exit(1); @@ -1827,6 +1833,8 @@ static int psftp_connect(char *userhost, char *user, int portnumber) fprintf(stderr, "ssh_init: %s\n", err); return 1; } + logctx = log_init(NULL); + back->provide_logctx(backhandle, logctx); ssh_sftp_init(); if (verbose && realhost != NULL) printf("Connected to %s\n", realhost);