else
Aliases = new;
- strfcpy (buf, NONULL (AliasFile), sizeof (buf));
- if (mutt_get_field (_("Save to file: "), buf, sizeof (buf), MUTT_FILE) != 0)
- return;
- mutt_expand_path (buf, sizeof (buf));
- if ((rc = fopen (buf, "a+")))
+ for (LIST *AliasFile = AliasFiles; AliasFile != NULL;
+ AliasFile = AliasFile->next)
{
- /* terminate existing file with \n if necessary */
- if (fseek (rc, 0, SEEK_END))
- goto fseek_err;
- if (ftell(rc) > 0)
+ strfcpy(buf, NONULL(AliasFile->data), sizeof(buf));
+ if (mutt_get_field(_("Save to file: "), buf, sizeof(buf), MUTT_FILE) != 0)
+ return;
+ mutt_expand_path(buf, sizeof(buf));
+ if ((rc = fopen(buf, "a+")))
{
- if (fseek (rc, -1, SEEK_CUR) < 0)
- goto fseek_err;
- if (fread(buf, 1, 1, rc) != 1)
+ /* terminate existing file with \n if necessary */
+ if (fseek(rc, 0, SEEK_END))
+ goto fseek_err;
+ if (ftell(rc) > 0)
{
- mutt_perror (_("Error reading alias file"));
- safe_fclose (&rc);
- return;
+ if (fseek(rc, -1, SEEK_CUR) < 0)
+ goto fseek_err;
+ if (fread(buf, 1, 1, rc) != 1)
+ {
+ mutt_perror(_("Error reading alias file"));
+ safe_fclose(&rc);
+ return;
+ }
+ if (fseek(rc, 0, SEEK_END) < 0)
+ goto fseek_err;
+ if (buf[0] != '\n')
+ fputc('\n', rc);
}
- if (fseek (rc, 0, SEEK_END) < 0)
- goto fseek_err;
- if (buf[0] != '\n')
- fputc ('\n', rc);
- }
- if (mutt_check_alias_name (new->name, NULL, 0))
- mutt_quote_filename (buf, sizeof (buf), new->name);
- else
- strfcpy (buf, new->name, sizeof (buf));
- recode_buf (buf, sizeof (buf));
- fprintf (rc, "alias %s ", buf);
- buf[0] = 0;
- rfc822_write_address (buf, sizeof (buf), new->addr, 0);
- recode_buf (buf, sizeof (buf));
- write_safe_address (rc, buf);
- fputc ('\n', rc);
- if (safe_fsync_close(&rc) != 0)
- mutt_message ("Trouble adding alias: %s.", strerror(errno));
+ if (mutt_check_alias_name(new->name, NULL, 0))
+ mutt_quote_filename(buf, sizeof(buf), new->name);
+ else
+ strfcpy(buf, new->name, sizeof(buf));
+ recode_buf(buf, sizeof(buf));
+ fprintf(rc, "alias %s ", buf);
+ buf[0] = 0;
+ rfc822_write_address(buf, sizeof(buf), new->addr, 0);
+ recode_buf(buf, sizeof(buf));
+ write_safe_address(rc, buf);
+ fputc('\n', rc);
+ if (safe_fsync_close(&rc) != 0)
+ mutt_message("Trouble adding alias: %s.", strerror(errno));
+ else
+ mutt_message(_("Alias added."));
+ }
else
- mutt_message (_("Alias added."));
+ mutt_perror(buf);
}
- else
- mutt_perror (buf);
return;
xdg_cfg_home = buffer;
}
- Muttrc = mutt_find_cfg (Homedir, xdg_cfg_home);
+ char *config = mutt_find_cfg (Homedir, xdg_cfg_home);
+ if (config)
+ Muttrc = mutt_add_list (Muttrc, config);
}
else
{
- strfcpy (buffer, Muttrc, sizeof (buffer));
- FREE (&Muttrc);
- mutt_expand_path (buffer, sizeof (buffer));
- Muttrc = safe_strdup (buffer);
- if (access (Muttrc, F_OK))
+ for (LIST *config = Muttrc; config != NULL; config = config->next)
{
- snprintf (buffer, sizeof (buffer), "%s: %s", Muttrc, strerror (errno));
- mutt_endwin (buffer);
- exit (1);
+ strfcpy(buffer, config->data, sizeof(buffer));
+ FREE(&config->data);
+ mutt_expand_path(buffer, sizeof(buffer));
+ config->data = safe_strdup(buffer);
+ if (access(config->data, F_OK))
+ {
+ snprintf(buffer, sizeof(buffer), "%s: %s", config->data, strerror(errno));
+ mutt_endwin(buffer);
+ exit(1);
+ }
}
}
if (Muttrc)
{
- FREE (&AliasFile);
- AliasFile = safe_strdup (Muttrc);
+ FREE (&AliasFiles);
+ AliasFiles = mutt_copy_list(Muttrc);
}
/* Process the global rc file if it exists and the user hasn't explicity
}
/* Read the user's initialization file. */
- if (Muttrc)
+ for (LIST *config = Muttrc; config != NULL; config = config->next)
{
- if (!option (OPTNOCURSES))
- endwin ();
- if (source_rc (Muttrc, &err) != 0)
+ if (config->data)
{
- fputs (err.data, stderr);
- fputc ('\n', stderr);
- need_pause = 1;
+ if (!option(OPTNOCURSES))
+ endwin();
+ if (source_rc(config->data, &err) != 0)
+ {
+ fputs(err.data, stderr);
+ fputc('\n', stderr);
+ need_pause = 1;
+ }
}
}