snprintf (buffer, sizeof (buffer), "%s/.muttrc-%s", NONULL(Homedir), VERSION);
snprintf (buffer, sizeof (buffer), "%s/.muttrc-%s", NONULL(Homedir), MUTT_VERSION);
void mutt_init (int skip_sys_rc, LIST *commands){  struct passwd *pw;  struct utsname utsname;  char *p, buffer[STRING], error[STRING];  int i, default_rc = 0, need_pause = 0;  BUFFER err;  memset (&err, 0, sizeof (err));  err.data = error;  err.dsize = sizeof (error);  /* on one of the systems I use, getcwd() does not return the same prefix     as is listed in the passwd file */  if ((p = getenv ("HOME")))    Homedir = safe_strdup (p);  /* Get some information about the user */  if ((pw = getpwuid (getuid ())))  {    Username = safe_strdup (pw->pw_name);    if (!Homedir)      Homedir = safe_strdup (pw->pw_dir);    if ((p = strchr (pw->pw_gecos, ',')))      Realname = mutt_substrdup (pw->pw_gecos, p);    else      Realname = safe_strdup (pw->pw_gecos);    Shell = safe_strdup (pw->pw_shell);  }  else   {    if (!Homedir)    {      mutt_endwin (NULL);      fputs ("unable to determine home directory", stderr);      exit (1);    }    if ((p = getenv ("USER")))      Username = safe_strdup (p);    else    {      mutt_endwin (NULL);      fputs ("unable to determine user", stderr);      exit (1);    }    Shell = safe_strdup ((p = getenv ("SHELL")) ? p : "/bin/sh");  }#ifdef DEBUG  /* Start up debugging mode if requested */  if (debuglevel > 0)    start_debug ();#endif  /* And about the host... */  uname (&utsname);  /* some systems report the FQDN instead of just the hostname */  if ((p = strchr (utsname.nodename, '.')))  {    Hostname = mutt_substrdup (utsname.nodename, p);    p++;    strfcpy (buffer, p, sizeof (buffer)); /* save the domain for below */  }  else    Hostname = safe_strdup (utsname.nodename);#ifndef DOMAIN#define DOMAIN buffer  if (!p && getdnsdomainname (buffer, sizeof (buffer)) == -1)    Fqdn = safe_strdup ("@");  else#endif /* DOMAIN */  {    Fqdn = safe_malloc (strlen (DOMAIN) + strlen (NONULL(Hostname)) + 2);    sprintf (Fqdn, "%s.%s", NONULL(Hostname), DOMAIN);  }  if ((p = getenv ("MAIL")))    Spoolfile = safe_strdup (p);  else  {#ifdef HOMESPOOL    snprintf (buffer, sizeof (buffer), "%s/%s", NONULL(Homedir), MAILPATH);#else    snprintf (buffer, sizeof (buffer), "%s/%s", MAILPATH, NONULL(Username));#endif    Spoolfile = safe_strdup (buffer);  }  if ((p = getenv ("MAILCAPS")))    MailcapPath = safe_strdup (p);  else  {    /* Default search path from RFC1524 */    MailcapPath = safe_strdup ("~/.mailcap:" SHAREDIR "/mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap");  }  Tempdir = safe_strdup ((p = getenv ("TMPDIR")) ? p : "/tmp");  #ifdef _PGPPATH#ifdef _PGPV2PATH  PgpV2 = safe_strdup (_PGPV2PATH);  if ((p = getenv("PGPPATH")) != NULL)  {    snprintf (buffer, sizeof (buffer), "%s/pubring.pgp", p);    PgpV2Pubring = safe_strdup (buffer);    snprintf (buffer, sizeof (buffer), "%s/secring.pgp", p);     PgpV2Secring = safe_strdup (buffer);  }  else  {    snprintf (buffer, sizeof (buffer), "%s/.pgp/pubring.pgp", NONULL(Homedir));    PgpV2Pubring = safe_strdup (buffer);    snprintf (buffer, sizeof (buffer), "%s/.pgp/secring.pgp", NONULL(Homedir));    PgpV2Secring = safe_strdup (buffer);  }#endif#ifdef _PGPV3PATH  PgpV3 = safe_strdup (_PGPV3PATH);  if ((p = getenv("PGPPATH")) != NULL)  {    snprintf (buffer, sizeof (buffer), "%s/pubring.pkr", p);    PgpV3Pubring = safe_strdup (buffer);    snprintf (buffer, sizeof (buffer), "%s/secring.skr", p);     PgpV3Secring = safe_strdup (buffer);  }  else  {    snprintf (buffer, sizeof (buffer), "%s/.pgp/pubring.pkr", NONULL(Homedir));    PgpV3Pubring = safe_strdup (buffer);    snprintf (buffer, sizeof (buffer), "%s/.pgp/secring.skr", NONULL(Homedir));    PgpV3Secring = safe_strdup (buffer);  }#endif  #ifdef _PGPGPGPATH  PgpGpg = safe_strdup (_PGPGPGPATH);#endif#endif /* _PGPPATH */    #ifdef USE_POP  PopUser = safe_strdup (Username);#endif  Editor = safe_strdup ((p = getenv ("EDITOR")) ? p : "vi");  Visual = safe_strdup ((p = getenv ("VISUAL")) ? p : Editor);  if ((p = getenv ("REPLYTO")) != NULL)  {    BUFFER buf, token;    snprintf (buffer, sizeof (buffer), "Reply-To: %s", p);    memset (&buf, 0, sizeof (buf));    buf.data = buf.dptr = buffer;    buf.dsize = strlen (buffer);    memset (&token, 0, sizeof (token));    parse_my_hdr (&token, &buf, 0, &err);    FREE (&token.data);  }  /* Set standard defaults */  for (i = 0; MuttVars[i].option; i++)    mutt_restore_default (&MuttVars[i]);#ifndef LOCALES_HACK  /* Do we have a locale definition? */  if (((p = getenv ("LC_ALL")) != NULL && p[0]) ||      ((p = getenv ("LANG")) != NULL && p[0]) ||      ((p = getenv ("LC_CTYPE")) != NULL && p[0]))    set_option (OPTLOCALES);#endif  mutt_init_history ();  if (!Muttrc)  {    snprintf (buffer, sizeof (buffer), "%s/.mutt/muttrc-%s", NONULL(Homedir), VERSION);    if (access(buffer, F_OK) == -1)    {      snprintf (buffer, sizeof (buffer), "%s/.muttrc-%s", NONULL(Homedir), VERSION);      if (access (buffer, F_OK) == -1)      {	snprintf (buffer, sizeof (buffer), "%s/.mutt/muttrc", NONULL(Homedir));	if (access (buffer, F_OK) == -1)	  snprintf (buffer, sizeof (buffer), "%s/.muttrc", NONULL(Homedir));      }    }    default_rc = 1;    Muttrc = safe_strdup (buffer);  }  else  {    strfcpy (buffer, Muttrc, sizeof (buffer));    FREE (&Muttrc);    mutt_expand_path (buffer, sizeof (buffer));    Muttrc = safe_strdup (buffer);  }  FREE (&AliasFile);  AliasFile = safe_strdup (NONULL(Muttrc));  /* Process the global rc file if it exists and the user hasn't explicity     requested not to via "-n".  */  if (!skip_sys_rc)  {    snprintf (buffer, sizeof (buffer), "%s/Muttrc-%s", SHAREDIR, VERSION);    if (access (buffer, F_OK) == -1)      snprintf (buffer, sizeof (buffer), "%s/Muttrc", SHAREDIR);    if (access (buffer, F_OK) != -1)    {      if (source_rc (buffer, &err) != 0)      {	fputs (err.data, stderr);	fputc ('\n', stderr);	need_pause = 1;      }    }  }  /* Read the user's initialization file.  */  if (access (Muttrc, F_OK) != -1)  {    if (!option (OPTNOCURSES))      endwin ();    if (source_rc (Muttrc, &err) != 0)    {      fputs (err.data, stderr);      fputc ('\n', stderr);      need_pause = 1;    }  }  else if (!default_rc)  {    /* file specified by -F does not exist */    snprintf (buffer, sizeof (buffer), "%s: %s", Muttrc, strerror (errno));    mutt_endwin (buffer);    exit (1);  }  if (mutt_execute_commands (commands) != 0)    need_pause = 1;  if (need_pause && !option (OPTNOCURSES))  {    if (mutt_any_key_to_continue (NULL) == -1)      mutt_exit(1);  }  set_option (OPTWEED); /* turn weeding on by default */}