From 13eafebff182bda5532943b7512dc9d2105769e1 Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 25 Sep 2000 09:27:26 +0000 Subject: [PATCH] Enable PuTTY command line to deal with "user@host" format git-svn-id: svn://svn.tartarus.org/sgt/putty@620 cda61777-01e9-0310-a592-d414129be87e --- window.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/window.c b/window.c index 6dba5b1e..d94c23ba 100644 --- a/window.c +++ b/window.c @@ -229,6 +229,19 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) { return 0; } } + + /* See if host is of the form user@host */ + if (cfg.host[0] != '\0') { + char *atsign = strchr(cfg.host, '@'); + /* Make sure we're not overflowing the user field */ + if (atsign) { + if (atsign-cfg.host < sizeof cfg.username) { + strncpy (cfg.username, cfg.host, atsign-cfg.host); + cfg.username[atsign-cfg.host] = '\0'; + } + memmove(cfg.host, atsign+1, 1+strlen(atsign+1)); + } + } } /* -- 2.11.0