1
0
mirror of https://github.com/simh/simh.git synced 2026-01-26 20:12:23 +00:00

CONSOLE: Add optional destination port SET CONSOLE TELNET=CONNECT{=port}

This allows SCP commands to create a local telnet session window connected
to either the local simulator console or another localhost tcp port.
This commit is contained in:
Mark Pizzolato
2023-07-02 12:44:27 -10:00
parent 6491cf0371
commit 7c0f13cab2

View File

@@ -2639,13 +2639,23 @@ else
return SCPE_OK;
}
/* Start telnet session/window to console */
/* Start telnet session/window to console or optionally an arbitrary TCP port on the local system */
t_stat sim_set_cons_connect (int32 flg, CONST char *cptr)
{
if (sim_con_tmxr.port == NULL)
return sim_messagef (SCPE_ARG, "Console not listening for telnet connections\n");
return sim_os_connect_telnet (atoi (sim_con_tmxr.port));
if ((cptr != NULL) && (*cptr != '\0')) {
t_stat r;
uint32 port = (uint32)get_uint (cptr, 10, 65535, &r);
if ((port == 0) || (r != SCPE_OK))
return sim_messagef (SCPE_ARG, "Invalid TCP port for telnet connection: %s\n", cptr);
}
else
if (sim_con_tmxr.port == NULL)
return sim_messagef (SCPE_ARG, "Console not listening for telnet connections\n");
else
cptr = sim_con_tmxr.port;
return sim_os_connect_telnet (atoi (cptr));
}