X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/blobdiff_plain/f133db8e0a997ab97b0b68a870b56f49501fcfae..edc7395917e62e670eb875286e8d68ff24c8eb95:/psftp.c diff --git a/psftp.c b/psftp.c index 6f849d4d..32d24f78 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 */ @@ -1732,6 +1745,21 @@ static int psftp_connect(char *userhost, char *user, int portnumber) */ cfg.host[strcspn(cfg.host, ":")] = '\0'; + /* + * Remove any remaining whitespace from the hostname. + */ + { + int p1 = 0, p2 = 0; + while (cfg.host[p2] != '\0') { + if (cfg.host[p2] != ' ' && cfg.host[p2] != '\t') { + cfg.host[p1] = cfg.host[p2]; + p1++; + } + p2++; + } + cfg.host[p1] = '\0'; + } + /* Set username */ if (user != NULL && user[0] != '\0') { strncpy(cfg.username, user, sizeof(cfg.username) - 1);