Commit ddc30688 authored by Moritz Grimm's avatar Moritz Grimm
Browse files

Remove unused function

parent cb997e54
......@@ -341,54 +341,3 @@ util_shellquote(const char *in, size_t outlen_max)
return (out);
}
int
util_urlparse(const char *url, char **hostname, unsigned short *port,
char **mountname)
{
const char *p1, *p2, *p3;
char tmpPort[6] = "";
size_t hostsiz, mountsiz;
const char *errstr;
if (strncmp(url, "http://", strlen("http://")) != 0) {
log_error("invalid <url>: not an HTTP address");
return (0);
}
p1 = url + strlen("http://");
p2 = strchr(p1, ':');
if (p2 == NULL) {
log_error("invalid <url>: missing port");
return (0);
}
hostsiz = (p2 - p1) + 1;
if (hostsiz <= 1) {
log_error("invalid <url>: missing host");
return (0);
}
*hostname = xmalloc(hostsiz);
strlcpy(*hostname, p1, hostsiz);
p2++;
p3 = strchr(p2, '/');
if (p3 == NULL || p3 - p2 >= (int)sizeof(tmpPort)) {
log_error("invalid <url>: mountpoint missing, or port number too long");
xfree(*hostname);
return (0);
}
strlcpy(tmpPort, p2, (p3 - p2) + 1UL);
*port = (unsigned short)strtonum(tmpPort, 1LL, (long long)USHRT_MAX, &errstr);
if (errstr) {
log_error("invalid <url>: port: %s is %s", tmpPort, errstr);
xfree(*hostname);
return (0);
}
mountsiz = strlen(p3) + 1;
*mountname = xmalloc(mountsiz);
strlcpy(*mountname, p3, mountsiz);
return (1);
}
......@@ -28,6 +28,5 @@ char * util_char2utf8(const char *);
char * util_utf82char(const char *);
char * util_expand_words(const char *, struct util_dict[]);
char * util_shellquote(const char *, size_t);
int util_urlparse(const char *, char **, unsigned short *, char **);
#endif /* __UTIL_H__ */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment