Skip to content
Snippets Groups Projects
Commit 1c6aa05e authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

If ":<port>" suffix is included in an added TCP address, parse/use it

When adding a BBS entry with a TCP connection, if a ":port" suffix is included
(e.g. "vert.synchro.net:23"), parse and use that port number for the new entry
automatically and remove the suffix from the adddress itself.
This is just a time saver when adding new BBS entries.

Care was taken to not treat the following addresses in this manner:
 ":<port>"   - would have resulted in a blank address
 "a::<port>" - possible IPv6 address
 "a:<port>b" - possible IPv6 address or ... ?
 "a:<invalid-port>"
parent 360c676e
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #4087 passed
......@@ -2821,6 +2821,27 @@ show_bbslist(char *current, int connected)
list[listcount - 1]->addr,
LIST_ADDR_MAX,
K_EDIT);
// Parse TCP port from address, if specified
switch(list[listcount -1]->conn_type) {
case CONN_TYPE_MODEM:
case CONN_TYPE_SERIAL:
case CONN_TYPE_SERIAL_NORTS:
case CONN_TYPE_SHELL:
break;
default:
{
char* p = strrchr(list[listcount - 1]->addr + 1, ':');
if(p != NULL && p == strchr(list[listcount -1]->addr, ':')) {
char* tp;
long port = strtol(p + 1, &tp, 10);
if(*tp == '\0' && port > 0 && port <= 65535) {
list[listcount -1]->port = port;
*p = '\0';
}
}
break;
}
}
check_exit(false);
}
if (quitting || !uifc.changes) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment