+bool irc::sockets::untosa(const std::string& path, irc::sockets::sockaddrs& sa)
+{
+ memset(&sa, 0, sizeof(sa));
+ if (path.length() >= sizeof(sa.un.sun_path))
+ return false;
+
+ sa.un.sun_family = AF_UNIX;
+ memcpy(&sa.un.sun_path, path.c_str(), path.length() + 1);
+ return true;
+}
+
+bool irc::sockets::isunix(const std::string& file)
+{
+#ifndef _WIN32
+ struct stat sb;
+ if (stat(file.c_str(), &sb) == 0 && S_ISSOCK(sb.st_mode))
+ return true;
+#endif
+ return false;
+}
+
+