static int get_default_instance_port(const char hostname[]) { char ip[24] = {'\0'}; tds_lookup_host(hostname, ip); if (!*ip) return 0; return tds7_get_instance_port(ip, "MSSQLSERVER"); }
static int get_default_instance_port(const char hostname[]) { int port; struct addrinfo *addr; if ((addr = tds_lookup_host(hostname)) == NULL) return 0; port = tds7_get_instance_port(addr, "MSSQLSERVER"); freeaddrinfo(addr); return port; }