fixed host name parse
This commit is contained in:
1 parent
d486eb746f
commit
24b8e85338
1 file changed
+11
-25
+11
-25
@@ -112,34 +112,20 @@ epicsShareFunc int epicsShareAPI
|
||||
/*
|
||||
* check for a valid host name before giving up
|
||||
*/
|
||||
status = sscanf (pAddrString, " %511[^:]:%hu", hostName, &port);
|
||||
if (status>0) {
|
||||
if (status==2) {
|
||||
status = hostToIPAddr (hostName, &ina);
|
||||
if (status==0) {
|
||||
return initIPAddr (ina, port, pIP);
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
status = sscanf ( pAddrString, " %511[^:]:%hu", hostName, &port );
|
||||
if ( status >= 1 ) {
|
||||
if ( status == 1 ) {
|
||||
port = defaultPort;
|
||||
}
|
||||
else {
|
||||
return-1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
status = sscanf (pAddrString, " %511s", hostName, &port);
|
||||
if (status==1) {
|
||||
status = hostToIPAddr (hostName, &ina);
|
||||
if (status==0) {
|
||||
return initIPAddr (ina, defaultPort, pIP);
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
status = hostToIPAddr ( hostName, &ina );
|
||||
if ( status == 0 ) {
|
||||
return initIPAddr ( ina, port, pIP );
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user