6 #include <sys/utsname.h>
11 @@ -2952,6 +2953,31 @@
15 +int getmailname(char *s, size_t l)
21 + if ((f = fopen ("/etc/mailname", "r")) == NULL)
24 + if (fgets (tmp, 510, f) != NULL) {
25 + while (*p && !ISSPACE(*p) && l > 0) {
40 void mutt_init (int skip_sys_rc, LIST *commands)
43 @@ -3026,10 +3052,25 @@
44 Hostname = mutt_substrdup (utsname.nodename, p);
46 strfcpy (buffer, p, sizeof (buffer)); /* save the domain for below */
47 + Fqdn = safe_strdup (utsname.nodename);
50 Hostname = safe_strdup (utsname.nodename);
52 + /* if /etc/mailname exists use it and ignore everything else */
53 + if (getmailname(buffer, sizeof (buffer)) != -1)
54 + Fqdn = safe_strdup(buffer);
56 + /* try gethostbyname(3) if /etc/mailname does not exists */
60 + if ((hp = gethostbyname(Hostname)))
61 + Fqdn = safe_strdup(hp->h_name);
68 if (!p && getdnsdomainname (buffer, sizeof (buffer)) == -1)