char *ipv6 = strchr(str, '['); if (ipv6) { str = strchr(str, ']'); if (str) {  *str++ = '\0'; return (str); } return (NULL); }
static char *colon(char *str){    /* We ignore a leading colon, since the hostname cannot be       empty. We also ignore a colon as second character because       of filenames like f:myfile.txt. */    if (str[0] == '\0' || str[0] == ':' || str[1] == ':')	return (NULL);    while (*str != '\0' && *str != ':' && *str != '/' && *str != '\\')	str++;    if (*str == ':')	return (str);    else	return (NULL);}