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