mhn: allow for whitespace in edit commands
Showing
1 changed file
with
23 additions
and
6 deletions
... | @@ -1744,7 +1744,7 @@ parse_brace (char **pval, char **cmd, int c, struct compose_env *env) | ... | @@ -1744,7 +1744,7 @@ parse_brace (char **pval, char **cmd, int c, struct compose_env *env) |
1744 | return 0; | 1744 | return 0; |
1745 | } | 1745 | } |
1746 | 1746 | ||
1747 | #define isdelim(c) (mu_isspace (c) || strchr (";<[(", c)) | 1747 | #define isdelim(c) (c == 0 || mu_isspace (c) || strchr (";<[(", c)) |
1748 | #define skipws(ptr) (ptr) = mu_str_skip_class (ptr, MU_CTYPE_SPACE) | 1748 | #define skipws(ptr) (ptr) = mu_str_skip_class (ptr, MU_CTYPE_SPACE) |
1749 | 1749 | ||
1750 | int | 1750 | int |
... | @@ -1754,7 +1754,7 @@ parse_content_type (struct compose_env *env, | ... | @@ -1754,7 +1754,7 @@ parse_content_type (struct compose_env *env, |
1754 | int status = 0, stop = 0; | 1754 | int status = 0, stop = 0; |
1755 | char *rest = *prest; | 1755 | char *rest = *prest; |
1756 | char *comment = NULL; | 1756 | char *comment = NULL; |
1757 | 1757 | ||
1758 | while (stop == 0 && status == 0 && *rest) | 1758 | while (stop == 0 && status == 0 && *rest) |
1759 | { | 1759 | { |
1760 | skipws (rest); | 1760 | skipws (rest); |
... | @@ -1823,12 +1823,29 @@ parse_content_type (struct compose_env *env, | ... | @@ -1823,12 +1823,29 @@ parse_content_type (struct compose_env *env, |
1823 | rest++; | 1823 | rest++; |
1824 | mu_opool_append_char (pool, '='); | 1824 | mu_opool_append_char (pool, '='); |
1825 | skipws (rest); | 1825 | skipws (rest); |
1826 | for (; *rest; rest++) | 1826 | if (*rest == '"') |
1827 | { | 1827 | { |
1828 | if (isdelim (*rest)) | ||
1829 | break; | ||
1830 | mu_opool_append_char (pool, *rest); | 1828 | mu_opool_append_char (pool, *rest); |
1829 | rest++; | ||
1830 | while (*rest != '"') | ||
1831 | { | ||
1832 | if (*rest == '\\') | ||
1833 | { | ||
1834 | mu_opool_append_char (pool, *rest); | ||
1835 | if (rest[1]) | ||
1836 | rest++; | ||
1837 | else | ||
1838 | break; | ||
1839 | } | ||
1840 | mu_opool_append_char (pool, *rest); | ||
1841 | rest++; | ||
1842 | } | ||
1843 | mu_opool_append_char (pool, *rest); | ||
1844 | rest++; | ||
1831 | } | 1845 | } |
1846 | else | ||
1847 | for (; !isdelim (*rest); rest++) | ||
1848 | mu_opool_append_char (pool, *rest); | ||
1832 | break; | 1849 | break; |
1833 | 1850 | ||
1834 | default: | 1851 | default: |
... | @@ -1867,7 +1884,7 @@ parse_type_command (char **pcmd, struct compose_env *env, mu_header_t hdr) | ... | @@ -1867,7 +1884,7 @@ parse_type_command (char **pcmd, struct compose_env *env, mu_header_t hdr) |
1867 | char *rest = *pcmd; | 1884 | char *rest = *pcmd; |
1868 | 1885 | ||
1869 | skipws (rest); | 1886 | skipws (rest); |
1870 | for (sp = rest; *sp && !isdelim (*sp); sp++) | 1887 | for (sp = rest; !isdelim (*sp); sp++) |
1871 | ; | 1888 | ; |
1872 | c = *sp; | 1889 | c = *sp; |
1873 | *sp = 0; | 1890 | *sp = 0; | ... | ... |
-
Please register or sign in to post a comment