Mercurial > vim
comparison src/ex_cmds.c @ 18195:a81f0c936112 v8.1.2092
patch 8.1.2092: MS-Windows: redirect in system() does not work
Commit: https://github.com/vim/vim/commit/1a613398068580ca1286ac2ed920f20c978aa662
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Sep 28 15:51:37 2019 +0200
patch 8.1.2092: MS-Windows: redirect in system() does not work
Problem: MS-Windows: redirect in system() does not work.
Solution: Handle 'shellxescape' and 'shellxquote' better. (Yasuhiro
Matsumoto, closes #2054)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 28 Sep 2019 16:00:03 +0200 |
parents | 1868ec23360e |
children | d27060eba45f |
comparison
equal
deleted
inserted
replaced
18194:52a1ffca4253 | 18195:a81f0c936112 |
---|---|
1760 { | 1760 { |
1761 STRCAT(buf, " < "); | 1761 STRCAT(buf, " < "); |
1762 STRCAT(buf, itmp); | 1762 STRCAT(buf, itmp); |
1763 } | 1763 } |
1764 #else | 1764 #else |
1765 /* | 1765 // For shells that don't understand braces around commands, at least allow |
1766 * For shells that don't understand braces around commands, at least allow | 1766 // the use of commands in a pipe. |
1767 * the use of commands in a pipe. | 1767 if (*p_sxe != NUL && *p_sxq == '(') |
1768 */ | 1768 { |
1769 STRCPY(buf, cmd); | 1769 if (itmp != NULL || otmp != NULL) |
1770 if (itmp != NULL) | 1770 vim_snprintf((char *)buf, len, "(%s)", (char *)cmd); |
1771 else | |
1772 STRCPY(buf, cmd); | |
1773 if (itmp != NULL) | |
1774 { | |
1775 STRCAT(buf, " < "); | |
1776 STRCAT(buf, itmp); | |
1777 } | |
1778 } | |
1779 else | |
1771 { | 1780 { |
1772 char_u *p; | 1781 char_u *p; |
1773 | 1782 |
1774 /* | 1783 /* |
1775 * If there is a pipe, we have to put the '<' in front of it. | 1784 * If there is a pipe, we have to put the '<' in front of it. |
1817 { | 1826 { |
1818 char_u *p; | 1827 char_u *p; |
1819 char_u *end; | 1828 char_u *end; |
1820 | 1829 |
1821 end = buf + STRLEN(buf); | 1830 end = buf + STRLEN(buf); |
1822 /* find "%s" */ | 1831 // find "%s" |
1823 for (p = opt; (p = vim_strchr(p, '%')) != NULL; ++p) | 1832 for (p = opt; (p = vim_strchr(p, '%')) != NULL; ++p) |
1824 { | 1833 { |
1825 if (p[1] == 's') /* found %s */ | 1834 if (p[1] == 's') // found %s |
1826 break; | 1835 break; |
1827 if (p[1] == '%') /* skip %% */ | 1836 if (p[1] == '%') // skip %% |
1828 ++p; | 1837 ++p; |
1829 } | 1838 } |
1830 if (p != NULL) | 1839 if (p != NULL) |
1831 { | 1840 { |
1832 *end = ' '; /* not really needed? Not with sh, ksh or bash */ | 1841 #ifdef MSWIN |
1833 vim_snprintf((char *)end + 1, (size_t)(buflen - (end + 1 - buf)), | 1842 *end++ = ' '; // not really needed? Not with sh, ksh or bash |
1843 #endif | |
1844 vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), | |
1834 (char *)opt, (char *)fname); | 1845 (char *)opt, (char *)fname); |
1835 } | 1846 } |
1836 else | 1847 else |
1837 vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), | 1848 vim_snprintf((char *)end, (size_t)(buflen - (end - buf)), |
1838 #ifdef FEAT_QUICKFIX | 1849 #ifdef FEAT_QUICKFIX |
1839 " %s %s", | 1850 " %s %s", |
1840 #else | 1851 #else |
1841 " %s%s", /* " > %s" causes problems on Amiga */ | 1852 " %s%s", // " > %s" causes problems on Amiga |
1842 #endif | 1853 #endif |
1843 (char *)opt, (char *)fname); | 1854 (char *)opt, (char *)fname); |
1844 } | 1855 } |
1845 | 1856 |
1846 /* | 1857 /* |