diff options
author | Joël Riou <joel.riou@normalesup.org> | 2004-04-12 19:42:10 +0000 |
---|---|---|
committer | Joël Riou <joel.riou@normalesup.org> | 2004-04-12 19:42:10 +0000 |
commit | 50cf25b02315c95ab5e4505a35ea0f52c268a06a (patch) | |
tree | 95463f9b09241d2299c1d6e7811377993e98eeba /init.c | |
parent | c2025cae4815930427ba1fdf57b05949d80a1791 (diff) |
Introduce config_charset.
Diffstat (limited to 'init.c')
-rw-r--r-- | init.c | 24 |
1 files changed, 21 insertions, 3 deletions
@@ -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(¤tline, 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(¤tline); break; + } } else + { if (rc < 0) rc = -1; + } + if (conv) + FREE(¤tline); } FREE (&token.data); FREE (&linebuf); |