2 * Copyright notice from original mutt:
5 * This file is part of mutt-ng, see http://www.muttng.org/.
6 * It's licensed under the GNU General Public License,
7 * please see the file GPL in the top level source directory.
24 /* poor man's version of getdomainname() for systems where it does not return
25 * return the DNS domain, but the NIS domain.
28 static void strip_trailing_dot (char *q)
39 int getdnsdomainname (char *s, size_t l)
46 if ((f = fopen ("/etc/resolv.conf", "r")) == NULL)
49 tmp[sizeof (tmp) - 1] = 0;
51 l--; /* save room for the terminal \0 */
53 while (fgets (tmp, sizeof (tmp) - 1, f) != NULL) {
57 if (mutt_strncmp ("domain", p, 6) == 0
58 || mutt_strncmp ("search", p, 6) == 0) {
61 for (q = strtok (p, " \t\n"); q; q = strtok (NULL, " \t\n"))
66 strip_trailing_dot (q);