summaryrefslogtreecommitdiffstats
path: root/init.c
diff options
context:
space:
mode:
authorJoël Riou <joel.riou@normalesup.org>2004-04-12 19:42:10 +0000
committerJoël Riou <joel.riou@normalesup.org>2004-04-12 19:42:10 +0000
commit50cf25b02315c95ab5e4505a35ea0f52c268a06a (patch)
tree95463f9b09241d2299c1d6e7811377993e98eeba /init.c
parentc2025cae4815930427ba1fdf57b05949d80a1791 (diff)
Introduce config_charset.
Diffstat (limited to 'init.c')
-rw-r--r--init.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/init.c b/init.c
index f6568e9f..3d1c13a0 100644
--- a/init.c
+++ b/init.c
@@ -1363,9 +1363,10 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err)
static int source_rc (const char *rcfile, BUFFER *err)
{
FILE *f;
- int line = 0, rc = 0;
+ int line = 0, rc = 0, conv = 0;
BUFFER token;
char *linebuf = NULL;
+ char *currentline = NULL;
size_t buflen;
pid_t pid;
@@ -1378,15 +1379,32 @@ static int source_rc (const char *rcfile, BUFFER *err)
memset (&token, 0, sizeof (token));
while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line)) != NULL)
{
- if (mutt_parse_rc_line (linebuf, &token, err) == -1)
+ conv=ConfigCharset && (*ConfigCharset) && Charset;
+ if (conv)
+ {
+ currentline=safe_strdup(linebuf);
+ if (!currentline) continue;
+ mutt_convert_string(&currentline, ConfigCharset, Charset, 0);
+ }
+ else
+ currentline=linebuf;
+
+ if (mutt_parse_rc_line (currentline, &token, err) == -1)
{
mutt_error (_("Error in %s, line %d: %s"), rcfile, line, err->data);
- if (--rc < -MAXERRS)
+ if (--rc < -MAXERRS)
+ {
+ if (conv) FREE(&currentline);
break;
+ }
}
else
+ {
if (rc < 0)
rc = -1;
+ }
+ if (conv)
+ FREE(&currentline);
}
FREE (&token.data);
FREE (&linebuf);