X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/c0a8159289da8df577cc28be1f0c9f7f5c8d33c1..e8e8d6e2aaec02b9687ca8f2029bb6473acb0ec7:/psftp.c diff --git a/psftp.c b/psftp.c index d498b07d..4657091f 100644 --- a/psftp.c +++ b/psftp.c @@ -1457,6 +1457,19 @@ void fatalbox(char *fmt, ...) cleanup_exit(1); } +void modalfatalbox(char *fmt, ...) +{ + char str[0x100]; /* Make the size big enough */ + va_list ap; + va_start(ap, fmt); + strcpy(str, "Fatal:"); + vsprintf(str + strlen(str), fmt, ap); + va_end(ap); + strcat(str, "\n"); + fputs(str, stderr); + + cleanup_exit(1); +} void connection_fatal(char *fmt, ...) { char str[0x100]; /* Make the size big enough */ @@ -1650,8 +1663,14 @@ static void usage(void) printf(" -bc output batchfile commands\n"); printf(" -be don't stop batchfile processing if errors\n"); printf(" -v show verbose messages\n"); + printf(" -load sessname Load settings from saved session\n"); + printf(" -l user connect with specified username\n"); printf(" -P port connect to specified port\n"); printf(" -pw passw login with specified password\n"); + printf(" -1 -2 force use of particular SSH protocol version\n"); + printf(" -C enable compression\n"); + printf(" -i key private key file for authentication\n"); + printf(" -batch disable all interactive prompts\n"); cleanup_exit(1); } @@ -1684,7 +1703,15 @@ static int psftp_connect(char *userhost, char *user, int portnumber) do_defaults(NULL, &cfg); strncpy(cfg.host, host, sizeof(cfg.host) - 1); cfg.host[sizeof(cfg.host) - 1] = '\0'; - cfg.port = 22; + } + + /* + * Force use of SSH. (If they got the protocol wrong we assume the + * port is useless too.) + */ + if (cfg.protocol != PROT_SSH) { + cfg.protocol = PROT_SSH; + cfg.port = 22; } /* @@ -1735,9 +1762,6 @@ static int psftp_connect(char *userhost, char *user, int portnumber) } } - if (cfg.protocol != PROT_SSH) - cfg.port = 22; - if (portnumber) cfg.port = portnumber; @@ -1846,8 +1870,6 @@ int main(int argc, char *argv[]) } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "-?") == 0) { usage(); - } else if (strcmp(argv[i], "-l") == 0 && i + 1 < argc) { - user = argv[++i]; } else if (strcmp(argv[i], "-batch") == 0) { console_batch_mode = 1; } else if (strcmp(argv[i], "-b") == 0 && i + 1 < argc) {