| 232 | #endif |
| 233 | |
| 234 | int parsehost(int family, unsigned char *host, struct sockaddr *sa){ |
| 235 | char *sp=NULL,*se=NULL; |
| 236 | unsigned short port=0; |
| 237 | int ret = 0; |
| 238 | |
| 239 | if(!host) return 2; |
| 240 | if(*host == '[') se=strchr((char *)host, ']'); |
| 241 | if ( (sp = strchr(se?se:(char *)host, ':')) && !strchr(sp+1, ':')) *sp = 0; |
| 242 | if(se){ |
| 243 | *se = 0; |
| 244 | } |
| 245 | if(sp){ |
| 246 | port = atoi(sp+1); |
| 247 | } |
| 248 | ret = !getip46(family, host + (se!=0), (struct sockaddr *)sa); |
| 249 | if(se) *se = ']'; |
| 250 | if(sp) *sp = ':'; |
| 251 | if(port)*SAPORT(sa) = htons(port); |
| 252 | return ret; |
| 253 | } |
| 254 | |
| 255 | int parsehostname(char *hostname, struct clientparam *param, unsigned short port){ |
| 256 | char *sp=NULL,*se=NULL; |
no outgoing calls
no test coverage detected