fixed host name parse

This commit is contained in:
Jeff Hill committed 2000-11-22 00:46:36 +00:00
1 parent d486eb746f
commit 24b8e85338
1 file changed
+11 -25
+11 -25
View File
@@ -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;
}
}