Trim leading whitespace off the hostname if it's there.
[u/mdw/putty] / window.c
index 437f7dd..269d08f 100644 (file)
--- a/window.c
+++ b/window.c
 #define VK_PROCESSKEY 0xE5
 #endif
 
+/* Needed for mouse wheel support and not defined in earlier SDKs. */
+#ifndef WM_MOUSEWHEEL
+#define WM_MOUSEWHEEL 0x020A
+#endif
+
 static LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
 static int TranslateKey(UINT message, WPARAM wParam, LPARAM lParam,
                        unsigned char *output);
@@ -297,6 +302,14 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
            }
        }
 
+       /*
+        * Trim leading whitespace off the hostname if it's there.
+        */
+       {
+           int space = strspn(cfg.host, " \t");
+           memmove(cfg.host, cfg.host+space, 1+strlen(cfg.host)-space);
+       }
+
        /* See if host is of the form user@host */
        if (cfg.host[0] != '\0') {
            char *atsign = strchr(cfg.host, '@');