summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2016-12-12 13:19:24 +0200
committerSergey Poznyakoff <gray@gnu.org.ua>2016-12-12 13:19:24 +0200
commita923b221dc3a620dd5507ad935774cc70c9c28ec (patch)
tree1a92512b69ef6baf43f423dfb7796bdad1cbfe0f
parentd8896b0e5fbd5628b54b7704ab6cb64560caa3b5 (diff)
downloadmailutils-a923b221dc3a620dd5507ad935774cc70c9c28ec.tar.gz
mailutils-a923b221dc3a620dd5507ad935774cc70c9c28ec.tar.bz2
mhn: allow for whitespace in edit commands
-rw-r--r--mh/mhn.c29
1 files changed, 23 insertions, 6 deletions
diff --git a/mh/mhn.c b/mh/mhn.c
index 9fcb83d8c..0d240115a 100644
--- a/mh/mhn.c
+++ b/mh/mhn.c
@@ -1744,7 +1744,7 @@ parse_brace (char **pval, char **cmd, int c, struct compose_env *env)
return 0;
}
-#define isdelim(c) (mu_isspace (c) || strchr (";<[(", c))
+#define isdelim(c) (c == 0 || mu_isspace (c) || strchr (";<[(", c))
#define skipws(ptr) (ptr) = mu_str_skip_class (ptr, MU_CTYPE_SPACE)
int
@@ -1754,7 +1754,7 @@ parse_content_type (struct compose_env *env,
int status = 0, stop = 0;
char *rest = *prest;
char *comment = NULL;
-
+
while (stop == 0 && status == 0 && *rest)
{
skipws (rest);
@@ -1823,12 +1823,29 @@ parse_content_type (struct compose_env *env,
rest++;
mu_opool_append_char (pool, '=');
skipws (rest);
- for (; *rest; rest++)
+ if (*rest == '"')
{
- if (isdelim (*rest))
- break;
mu_opool_append_char (pool, *rest);
+ rest++;
+ while (*rest != '"')
+ {
+ if (*rest == '\\')
+ {
+ mu_opool_append_char (pool, *rest);
+ if (rest[1])
+ rest++;
+ else
+ break;
+ }
+ mu_opool_append_char (pool, *rest);
+ rest++;
+ }
+ mu_opool_append_char (pool, *rest);
+ rest++;
}
+ else
+ for (; !isdelim (*rest); rest++)
+ mu_opool_append_char (pool, *rest);
break;
default:
@@ -1867,7 +1884,7 @@ parse_type_command (char **pcmd, struct compose_env *env, mu_header_t hdr)
char *rest = *pcmd;
skipws (rest);
- for (sp = rest; *sp && !isdelim (*sp); sp++)
+ for (sp = rest; !isdelim (*sp); sp++)
;
c = *sp;
*sp = 0;

Return to:

Send suggestions and report system problems to the System administrator.