kopia lustrzana https://github.com/Hamlib/Hamlib
Fix rig_open with device names
rodzic
a88faf29c7
commit
f7f9653b97
10
src/misc.c
10
src/misc.c
|
@ -1384,6 +1384,10 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6])
|
|||
port[0] = 0;
|
||||
dummy[0] = 0;
|
||||
|
||||
// Handle device names 1st
|
||||
if (strstr(hoststr, "/dev")) return -1;
|
||||
if (strncasecmp(hoststr, "com", 3)) return -1;
|
||||
|
||||
// bracketed IPV6 with optional port
|
||||
int n = sscanf(hoststr, "[%255[^]]]:%5s", host, port);
|
||||
|
||||
|
@ -1393,7 +1397,7 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6])
|
|||
}
|
||||
|
||||
// non-bracketed full IPV6 with optional link addr
|
||||
n = sscanf(hoststr, "%x:%x:%x:%x:%x:%x:%x:%x:%%%31[^:]:%5s", &net1, &net2, &net3,
|
||||
n = sscanf(hoststr, "%x:%x:%x:%x:%x:%x:%x:%x%%%31[^:]:%5s", &net1, &net2, &net3,
|
||||
&net4, &net5, &net6, &net7, &net8, link, port);
|
||||
if (n == 8 || n == 9)
|
||||
{
|
||||
|
@ -1407,8 +1411,8 @@ int HAMLIB_API parse_hoststr(char *hoststr, char host[256], char port[6])
|
|||
*p = 0;
|
||||
return RIG_OK;
|
||||
}
|
||||
// non-bracketed IPV6 with optional link addr
|
||||
n = sscanf(hoststr, "%x::%x:%x:%x:%x:%%%31[^:]:%5s", &net1, &net2, &net3,
|
||||
// non-bracketed IPV6 with optional link addr and optional port
|
||||
n = sscanf(hoststr, "%x::%x:%x:%x:%x%%%31[^:]:%5s", &net1, &net2, &net3,
|
||||
&net4, &net5, link, port);
|
||||
|
||||
if (strchr(hoststr, '%') && (n == 5 || n == 6))
|
||||
|
|
Ładowanie…
Reference in New Issue