+ if (!buf)
+ fatal_moan ("malloc failed");
+
+ strcpy (buf, home);
+ strcat (buf, "/");
+
+ while (1)
+ {
+
+
+ va_start (ap, fmt);
+ n = vsnprintf (buf + homelen, size - homelen, fmt, ap);
+ va_end (ap);
+
+ if (n > -1 && n < (size - homelen))
+ return buf;
+
+ if (n > -1) /* glibc 2.1 */
+ size = homelen + n + 1;
+ else /* glibc 2.0 */
+ size *= 2; /* twice the old size */
+
+ buf = realloc (buf, size);
+
+ if (!buf)
+ fatal_moan ("malloc failed");
+ }
+}
+
+
+int
+list_sockets (void)
+{
+ struct dirent *ent;
+ struct stat buf;
+ char *sn = NULL;
+ Socket *s;
+ char *sockdir = mome ("/.sympathy/");
+ DIR *dir = opendir (sockdir);