Commit a923b221 a923b221dc3a620dd5507ad935774cc70c9c28ec by Sergey Poznyakoff

mhn: allow for whitespace in edit commands

1 parent d8896b0e
Showing 1 changed file with 21 additions and 4 deletions
......@@ -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
......@@ -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))
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;
......