return strcmp(*a, *b);
}
+static void not_connected(void)
+{
+ printf("psftp: not connected to a host; use \"open host.name\"\n");
+}
+
/* ----------------------------------------------------------------------
* The meat of the `get' and `put' commands.
*/
int sftp_cmd_close(struct sftp_command *cmd)
{
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
int i;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
char *dir;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
int sftp_cmd_pwd(struct sftp_command *cmd)
{
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
int recurse = FALSE;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
int recurse = FALSE;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
int i, ret;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
if (!result) {
printf("mkdir %s: %s\n", dir, fxp_error());
- sfree(dir);
ret = 0;
- }
+ } else
+ printf("mkdir %s: OK\n", dir);
sfree(dir);
}
return 0;
}
+ printf("rmdir %s: OK\n", dir);
+
return 1;
}
int i, ret;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
return 0;
}
+ printf("rm %s: OK\n", fname);
+
return 1;
}
int i, ret;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
int i, ret;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
struct sftp_context_chmod actx, *ctx = &actx;
if (back == NULL) {
- printf("psftp: not connected to a host; use \"open host.name\"\n");
+ not_connected();
return 0;
}
return 0;
}
+int from_backend_untrusted(void *frontend_handle, const char *data, int len)
+{
+ /*
+ * No "untrusted" output should get here (the way the code is
+ * currently, it's all diverted by FLAG_STDERR).
+ */
+ assert(!"Unexpected call to from_backend_untrusted()");
+ return 0; /* not reached */
+}
int sftp_recvdata(char *buf, int len)
{
outptr = (unsigned char *) buf;
printf("%s\n", ver);
printf("Usage: psftp [options] [user@]host\n");
printf("Options:\n");
+ printf(" -V print version information and exit\n");
+ printf(" -pgpfp print PGP key fingerprints and exit\n");
printf(" -b file use specified batchfile\n");
printf(" -bc output batchfile commands\n");
printf(" -be don't stop batchfile processing if errors\n");
printf(" -4 -6 force use of IPv4 or IPv6\n");
printf(" -C enable compression\n");
printf(" -i key private key file for authentication\n");
+ printf(" -noagent disable use of Pageant\n");
+ printf(" -agent enable use of Pageant\n");
printf(" -batch disable all interactive prompts\n");
- printf(" -V print version information\n");
cleanup_exit(1);
}
cfg.username[sizeof(cfg.username) - 1] = '\0';
}
if (!cfg.username[0]) {
- if (!console_get_line("login as: ",
- cfg.username, sizeof(cfg.username), FALSE)) {
+ /* FIXME: leave this to ssh.c? */
+ int ret;
+ prompts_t *p = new_prompts(NULL);
+ p->to_server = TRUE;
+ p->name = dupstr("SSH login name");
+ add_prompt(p, dupstr("login as: "), TRUE, lenof(cfg.username));
+ ret = get_userpass_input(p, NULL, 0);
+ assert(ret >= 0);
+ if (!ret) {
+ free_prompts(p);
fprintf(stderr, "psftp: no username, aborting\n");
cleanup_exit(1);
} else {
- int len = strlen(cfg.username);
- if (cfg.username[len - 1] == '\n')
- cfg.username[len - 1] = '\0';
+ memcpy(cfg.username, p->prompts[0]->result, lenof(cfg.username));
+ free_prompts(p);
}
}
cfg.nopty = TRUE;
/*
- * Set up fallback option, for SSH1 servers or servers with the
+ * Set up fallback option, for SSH-1 servers or servers with the
* sftp subsystem not enabled but the server binary installed
* in the usual place. We only support fallback on Unix
* systems, and we use a kludgy piece of shellery which should
#endif
;
cmdline_tooltype = TOOLTYPE_FILETRANSFER;
- ssh_get_line = &console_get_line;
sk_init();
userhost = user = NULL;
} else if (strcmp(argv[i], "-h") == 0 ||
strcmp(argv[i], "-?") == 0) {
usage();
+ } else if (strcmp(argv[i], "-pgpfp") == 0) {
+ pgp_fingerprints();
+ return 1;
} else if (strcmp(argv[i], "-V") == 0) {
version();
} else if (strcmp(argv[i], "-batch") == 0) {