15 /* poor man's version of getdomainname() for systems where it does not return
16 * return the DNS domain, but the NIS domain.
19 static void strip_trailing_dot (char *q)
30 int getdnsdomainname (char *s, size_t l)
37 if ((f = fopen ("/etc/resolv.conf", "r")) == NULL) return (-1);
39 tmp[sizeof (tmp) - 1] = 0;
41 l--; /* save room for the terminal \0 */
43 while (fgets (tmp, sizeof (tmp) - 1, f) != NULL)
46 while (ISSPACE (*p)) p++;
47 if (mutt_strncmp ("domain", p, 6) == 0 || mutt_strncmp ("search", p, 6) == 0)
51 for (q = strtok (p, " \t\n"); q; q = strtok (NULL, " \t\n"))
57 strip_trailing_dot (q);