int __hnbad(const char *dotted)
{
	unsigned char c, n, *cp;
	unsigned char buf[NS_MAXCDNAME];

	cp = (unsigned char *)dotted;
	while ((c = *cp++))
		if (c < 0x21 || c > 0x7E)
			return (1);
	if (ns_name_pton(dotted, buf, sizeof(buf)) < 0)
		return (2);
	if (buf[0] > 0 && buf[1] == '-')
		return (3);
	cp = buf;
	while ((n = *cp++)) {
		if (n > 63)
			return (4);
		while (n--) {
			c = *cp++;
			if (c < '-' ||
			    (c > '-' && c < '0') ||
			    (c > '9' && c < 'A') ||
			    (c > 'Z' && c < '_') ||
			    (c > '_' && c < 'a') ||
			    c > 'z')
				return (5);
		}
	}
	return (0);
}
int __hnbad(const char *dotted)
{
	unsigned char c, n, *cp;
	unsigned char buf[NS_MAXCDNAME];

	cp = (unsigned char *)dotted;
	while ((c = *cp++))
		if (c < 0x21 || c > 0x7E)
			return (1);
	if (ns_name_pton(dotted, buf, sizeof(buf)) < 0)
		return (2);
	if (buf[0] > 0 && buf[1] == '-')
		return (3);
	cp = buf;
	while ((n = *cp++)) {
		if (n > 63)
			return (4);
		while (n--) {
			c = *cp++;
			if (c < '-' ||
			    (c > '-' && c < '0') ||
			    (c > '9' && c < 'A') ||
			    (c > 'Z' && c < '_') ||
			    (c > '_' && c < 'a') ||
			    c > 'z')
				return (5);
		}
	}
	return (0);
}