+ if (p) {
+ *p = '\0';
+ len = p - tok;
+ }
+ else
+ len = strlen(tok);
+
+ /* Fail quietly if tok is a hostname (not an address) */
+ if (strspn(tok, ".0123456789") != len
+#ifdef INET6
+ && strchr(tok, ':') == NULL
+#endif
+ ) {
+ if (p)
+ *p = '/';
+ return 0;
+ }