From bf962aa95d973d266241deb552e5e4ffae484692 Mon Sep 17 00:00:00 2001 From: Pierre Habouzit Date: Wed, 6 Dec 2006 10:14:35 +0100 Subject: [PATCH] do not make semicolons special in the config file anymore. update documentation wrt that. Signed-off-by: Pierre Habouzit --- doc/muttrc.man.head | 6 +++--- doc/muttrc.man.tail | 17 +++++++++++++++++ init.c | 10 ++++------ muttlib.c | 1 - protos.h | 18 ++++++++++-------- 5 files changed, 34 insertions(+), 18 deletions(-) diff --git a/doc/muttrc.man.head b/doc/muttrc.man.head index 7f474e5..8e13835 100644 --- a/doc/muttrc.man.head +++ b/doc/muttrc.man.head @@ -24,9 +24,9 @@ madmuttrc \- Configuration file for the Madmutt Mail User Agent .SH DESCRIPTION .PP A Madmutt configuration file consists of a series of \(lqcommands\(rq. -Each line of the file may contain one or more commands. When -multiple commands are used, they must be separated by a semicolon -(\(lq\fB;\fP\(rq). +Each line of the file shall contain only one command (madmutt does +not support commands beeing separated by semicolons [see INCOMPABILITIES WITH +MUTT]) .PP The hash mark, or pound sign (\(lq\fB#\fP\(rq), is used as a \(lqcomment\(rq character. You can use it to annotate your diff --git a/doc/muttrc.man.tail b/doc/muttrc.man.tail index 2f0b895..b9a93b7 100644 --- a/doc/muttrc.man.tail +++ b/doc/muttrc.man.tail @@ -1,4 +1,21 @@ .\" -*-nroff-*- +.SH INCOMPABILITIES WITH MUTT +.PP +.nf +\fBsemicolons and multicommands\fP +.fi +.IP +Unlike mutt, madmutt does not supports multiple commands per line. Meaning that +semicolons (\(lq\fB;\fP\(rq) are not special characters at all, and do not need +to be escaped anymore. Though, if you have escaped semicolons in your rc file, +madmutt will understand them correctly. Only multiple commands must be +rewritten, by just splitting the commands. So it's still possible to have a +madmuttrc that mutt understands (and the reverse too). +.IP +The rationale is that it's quite a common character (especially in headers as +it's the parameter separator) and that many commands per line is not a very good +practice for readability either. And as it was sometimes special sometimes not, +it also complicated the parsing a lot, hence the feature has been removed. .SH SEE ALSO .PP .BR iconv (1), diff --git a/init.c b/init.c index 82636f1..da7227d 100644 --- a/init.c +++ b/init.c @@ -732,9 +732,8 @@ static int parse_ignore (BUFFER * buf, BUFFER * s, return 0; } -static int parse_list (BUFFER * buf, BUFFER * s, - unsigned long data __attribute__ ((unused)), - BUFFER * err __attribute__ ((unused))) +static int parse_list(BUFFER * buf, BUFFER * s, unsigned long data, + BUFFER * err __attribute__ ((unused))) { do { mutt_extract_token (buf, s, 0); @@ -1251,8 +1250,7 @@ static int parse_alias (BUFFER * buf, BUFFER * s, set_option (OPTFORCEREDRAWINDEX); } - mutt_extract_token(buf, s, - M_TOKEN_QUOTE | M_TOKEN_SPACE | M_TOKEN_SEMICOLON); + mutt_extract_token(buf, s, M_TOKEN_QUOTE | M_TOKEN_SPACE); (*last)->addr = mutt_parse_adrlist((*last)->addr, buf->data); if (mutt_addrlist_to_idna((*last)->addr, &estr)) { snprintf (err->data, err->dsize, @@ -1928,7 +1926,7 @@ static int parse_source (BUFFER * tmp, BUFFER * s, every call to this function. err where to write error messages */ -int mutt_parse_rc_line ( /* const */ char *line, BUFFER * token, BUFFER * err) +int mutt_parse_rc_line (const char *line, BUFFER * token, BUFFER * err) { int i, r = -1; BUFFER expn; diff --git a/muttlib.c b/muttlib.c index 57fabf3..6ff6d89 100644 --- a/muttlib.c +++ b/muttlib.c @@ -501,7 +501,6 @@ int mutt_extract_token(BUFFER *dest, BUFFER *tok, int flags) if ((ISSPACE(ch) && !(flags & M_TOKEN_SPACE)) || (ch == '#' && !(flags & M_TOKEN_COMMENT)) || (ch == '=' && (flags & M_TOKEN_EQUAL)) - || (ch == ';' && !(flags & M_TOKEN_SEMICOLON)) || ((flags & M_TOKEN_PATTERN) && strchr("~=!|", ch))) { break; diff --git a/protos.h b/protos.h index 562e34a..0207638 100644 --- a/protos.h +++ b/protos.h @@ -129,7 +129,7 @@ int mutt_parse_exec (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_hook (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_macro (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_push (BUFFER *, BUFFER *, unsigned long, BUFFER *); -int mutt_parse_rc_line ( /* const */ char *, BUFFER *, BUFFER *); +int mutt_parse_rc_line (const char *, BUFFER *, BUFFER *); int mutt_parse_score (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *); @@ -157,13 +157,15 @@ void ci_bounce_message (HEADER *, int *); int ci_send_message (int, HEADER *, char *, CONTEXT *, HEADER *); /* flags for mutt_extract_token() */ -#define M_TOKEN_EQUAL 1 /* treat '=' as a special */ -#define M_TOKEN_CONDENSE (1<<1) /* ^(char) to control chars (macros) */ -#define M_TOKEN_SPACE (1<<2) /* don't treat whitespace as a term */ -#define M_TOKEN_QUOTE (1<<3) /* don't interpret quotes */ -#define M_TOKEN_PATTERN (1<<4) /* !)|~ are terms (for patterns) */ -#define M_TOKEN_COMMENT (1<<5) /* don't reap comments */ -#define M_TOKEN_SEMICOLON (1<<6) /* don't treat ; as special */ +#define M_TOKEN_EQUAL (1 << 0) /* treat '=' as a special */ +#define M_TOKEN_CONDENSE (1 << 1) /* ^(char) to control chars (macros) */ +#define M_TOKEN_SPACE (1 << 2) /* don't treat whitespace as a term */ +#define M_TOKEN_PATTERN (1 << 3) /* !)|~ are terms (for patterns) */ +/* equivalent to M_TOKEN_PATTERN */ +#define M_TOKEN_COMMENT (1 << 4) /* don't reap comments */ + +/* implies M_TOKEN_SPACE */ +#define M_TOKEN_QUOTE (1 << 5) /* don't interpret quotes */ int mutt_extract_token(BUFFER *, BUFFER *, int); -- 2.20.1