*/
extern const char *invalid_domainchar(const char *name);
-/*
- * converts <str> to a struct sockaddr_un* which is locally allocated.
- * The format is "/path", where "/path" is a path to a UNIX domain socket.
- */
-struct sockaddr_un *str2sun(const char *str);
-
/*
* converts <str> to a struct sockaddr_storage* which is locally allocated. The
* string is assumed to contain only an address, no port. The address can be a
return (n) ? ultoa_r(n, buffer, size) : (alt ? alt : "");
}
-/*
- * converts <str> to a struct sockaddr_un* which is locally allocated.
- * The format is "/path", where "/path" is a path to a UNIX domain socket.
- * NULL is returned if the socket path is invalid (too long).
- */
-struct sockaddr_un *str2sun(const char *str)
-{
- static struct sockaddr_un su;
- int strsz; /* length included null */
-
- memset(&su, 0, sizeof(su));
- strsz = strlen(str) + 1;
- if (strsz > sizeof(su.sun_path)) {
- return NULL;
- } else {
- su.sun_family = AF_UNIX;
- memcpy(su.sun_path, str, strsz);
- }
- return &su;
-}
-
/*
* Returns non-zero if character <s> is a hex digit (0-9, a-f, A-F), else zero.
*