*/
char *pwd, *homedir;
+static Backend *back;
+static void *backhandle;
/* ----------------------------------------------------------------------
* Higher-level helper functions used in commands.
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;
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,
}
int sftp_senddata(char *buf, int len)
{
- back->send((unsigned char *) buf, len);
+ back->send(backhandle, (unsigned char *) buf, len);
return 1;
}
{
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);
}
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);
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);
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();