Deal with $hostname and $shorthost
[apps/madmutt.git] / init.c
diff --git a/init.c b/init.c
index 2999e7e..ff02dce 100644 (file)
--- a/init.c
+++ b/init.c
@@ -11,7 +11,6 @@
  */
 
 #include <lib-lib/lib-lib.h>
-#include <sys/utsname.h>
 
 #include <lib-lua/lib-lua.h>
 #include <lib-sys/unix.h>
@@ -2142,7 +2141,6 @@ static int mutt_execute_commands (string_list_t * p)
 void mutt_init (int skip_sys_rc, string_list_t * commands)
 {
   struct passwd *pw;
-  struct utsname utsname;
   const char *p;
   char buffer[STRING], error[STRING];
   int default_rc = 0, need_pause = 0;
@@ -2172,27 +2170,6 @@ void mutt_init (int skip_sys_rc, string_list_t * commands)
     Realname = m_strdup(rnbuf);
   }
 
-  /* And about the host... */
-  uname (&utsname);
-  /* some systems report the FQDN instead of just the hostname */
-  if ((p = strchr (utsname.nodename, '.'))) {
-    Hostname = p_dupstr(utsname.nodename, p - utsname.nodename);
-    p++;
-    m_strcpy(buffer, sizeof(buffer), p);       /* save the domain for below */
-  }
-  else
-    Hostname = m_strdup(utsname.nodename);
-
-  if (!p && getdnsdomainname(buffer, sizeof(buffer)) == -1)
-    Fqdn = m_strdup("@");
-  else
-  if (*buffer != '@') {
-    Fqdn = p_new(char, m_strlen(buffer) + m_strlen(Hostname) + 2);
-    sprintf (Fqdn, "%s.%s", NONULL(Hostname), buffer);
-  }
-  else
-    Fqdn = m_strdup(NONULL (Hostname));
-
 #ifdef USE_NNTP
   {
     FILE *f;
@@ -2214,11 +2191,9 @@ void mutt_init (int skip_sys_rc, string_list_t * commands)
     NewsServer = m_strdup(p);
 #endif
 
-  if ((p = getenv ("MAIL")))
-    Spoolfile = m_strdup(p);
-  else if ((p = getenv ("MAILDIR")))
+  if ((p = getenv("MAIL") ?: getenv("MAILDIR"))) {
     Spoolfile = m_strdup(p);
-  else {
+  else {
 #ifdef HOMESPOOL
     mutt_concat_path(buffer, sizeof(buffer), NONULL(MCore.homedir), MAILPATH);
 #else