1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-05-31 08:50:29 -05:00

Enable handling of telnet:// URLs on command line

[originally from svn r514]
This commit is contained in:
Simon Tatham 2000-07-21 10:53:24 +00:00
parent 9546cf7393
commit 777e064ed5

View File

@ -173,6 +173,24 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
} }
} else if (*p) { } else if (*p) {
char *q = p; char *q = p;
/*
* If the hostname starts with "telnet://", set the
* protocol to Telnet and process the string as a
* Telnet URL.
*/
if (!strncmp(q, "telnet://", 9)) {
q += 9;
cfg.protocol = PROT_TELNET;
p = q;
while (*p && *p != ':') p++;
if (*p) {
*p++ = '\0';
cfg.port = atoi(p);
} else
cfg.port = -1;
strncpy (cfg.host, q, sizeof(cfg.host)-1);
cfg.host[sizeof(cfg.host)-1] = '\0';
} else {
while (*p && !isspace(*p)) p++; while (*p && !isspace(*p)) p++;
if (*p) if (*p)
*p++ = '\0'; *p++ = '\0';
@ -183,6 +201,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
cfg.port = atoi(p); cfg.port = atoi(p);
else else
cfg.port = -1; cfg.port = -1;
}
} else { } else {
if (!do_config()) { if (!do_config()) {
WSACleanup(); WSACleanup();