X-Git-Url: https://git.distorted.org.uk/u/mdw/putty/blobdiff_plain/4db4f6a6d75223cb2203afbab235ef44b3f4f960..fd02b8c05f488843ebb7a4ff9c1ec494f740b6b9:/scp.c diff --git a/scp.c b/scp.c index 5ebcfd2c..e8df3a46 100644 --- a/scp.c +++ b/scp.c @@ -234,6 +234,29 @@ 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"); + tell_str(stderr, str); + errs++; + + if (gui_mode) { + unsigned int msg_id = WM_RET_ERR_CNT; + if (list) + msg_id = WM_LS_RET_ERR_CNT; + while (!PostMessage + ((HWND) atoi(gui_hwnd), msg_id, (WPARAM) errs, + 0 /*lParam */ ))SleepEx(1000, TRUE); + } + + cleanup_exit(1); +} void connection_fatal(char *fmt, ...) { char str[0x100]; /* Make the size big enough */ @@ -489,6 +512,21 @@ static void do_cmd(char *host, char *user, char *cmd) */ 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);