X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=psftp.c;h=e5857321629658744a2a4d0eaf617e9a38bab366;hb=4756c15fc9556e2f29bdc65594ea15892f9b5d35;hp=f3f4c5b8189b32e452bc68683921adfd9660c9fb;hpb=0a80c983e2684c3eb177c14c1ad3f33677c498a6;p=PuTTY.git diff --git a/psftp.c b/psftp.c index f3f4c5b8..e5857321 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. @@ -1470,7 +1472,7 @@ void modalfatalbox(char *fmt, ...) cleanup_exit(1); } -void connection_fatal(char *fmt, ...) +void connection_fatal(void *frontend, char *fmt, ...) { char str[0x100]; /* Make the size big enough */ va_list ap; @@ -1484,7 +1486,7 @@ void connection_fatal(char *fmt, ...) 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, @@ -1610,7 +1612,7 @@ int sftp_recvdata(char *buf, int len) } int sftp_senddata(char *buf, int len) { - back->send((unsigned char *) buf, len); + back->send(backhandle, (unsigned char *) buf, len); return 1; } @@ -1621,7 +1623,7 @@ static void ssh_sftp_init(void) { if (sftp_ssh_socket == INVALID_SOCKET) return; - while (!back->sendok()) { + while (!back->sendok(backhandle)) { fd_set readfds; FD_ZERO(&readfds); FD_SET(sftp_ssh_socket, &readfds); @@ -1822,11 +1824,13 @@ static int psftp_connect(char *userhost, char *user, int portnumber) back = &ssh_backend; - err = back->init(NULL, cfg.host, cfg.port, &realhost, 0); + err = back->init(NULL, &backhandle, cfg.host, cfg.port, &realhost, 0); if (err != NULL) { 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); @@ -1921,9 +1925,9 @@ int main(int argc, char *argv[]) do_sftp(mode, modeflags, batchfile); - if (back != NULL && back->socket() != NULL) { + if (back != NULL && back->socket(backhandle) != NULL) { char ch; - back->special(TS_EOF); + back->special(backhandle, TS_EOF); sftp_recvdata(&ch, 1); } WSACleanup();