X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=scp.c;h=13b8080f3cb268e66bcf24972d08e76f54bdd082;hb=118fc8c81e6a850adbcc8dda409d9c10875eae7d;hp=cf79a0616bddd53112af43ee48ea1f022726367d;hpb=6a95a15aaab450a281fc80fdc82d05e8d57c3149;p=PuTTY.git diff --git a/scp.c b/scp.c index cf79a061..13b8080f 100644 --- a/scp.c +++ b/scp.c @@ -452,6 +452,11 @@ static void do_cmd(char *host, char *user, char *cmd) cfg.port = 22; } + /* + * Enact command-line overrides. + */ + cmdline_run_saved(); + /* * Trim leading whitespace off the hostname if it's there. */ @@ -690,6 +695,12 @@ void scp_sftp_listdir(char *dirname) int nnames, namesize; int i; + if (!fxp_init()) { + tell_user(stderr, "unable to initialise SFTP: %s", fxp_error()); + errs++; + return; + } + printf("Listing directory %s\n", dirname); dirh = fxp_opendir(dirname); @@ -2094,6 +2105,17 @@ static void usage(void) cleanup_exit(1); } +void cmdline_error(char *p, ...) +{ + va_list ap; + fprintf(stderr, "pscp: "); + va_start(ap, p); + vfprintf(stderr, p, ap); + va_end(ap); + fputc('\n', stderr); + exit(1); +} + /* * Main program (no, really?) */ @@ -2104,38 +2126,43 @@ int main(int argc, char *argv[]) default_protocol = PROT_TELNET; flags = FLAG_STDERR; + cmdline_tooltype = TOOLTYPE_FILETRANSFER; ssh_get_line = &console_get_line; init_winsock(); sk_init(); for (i = 1; i < argc; i++) { + int ret; if (argv[i][0] != '-') break; - if (strcmp(argv[i], "-v") == 0) - verbose = 1, flags |= FLAG_VERBOSE; - else if (strcmp(argv[i], "-r") == 0) + ret = cmdline_process_param(argv[i], i+1