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) ...@@ -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
...@@ -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)) 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
1829 break; 1838 break;
1839 }
1830 mu_opool_append_char (pool, *rest); 1840 mu_opool_append_char (pool, *rest);
1841 rest++;
1831 } 1842 }
1843 mu_opool_append_char (pool, *rest);
1844 rest++;
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;
......