patch 8.0.1051: cannot run terminal with spaces in argument
Problem: Cannot run terminal with spaces in argument.
Solution: Accept backslash to escape space and other characters. (closes
#1999)
diff --git a/src/os_unix.c b/src/os_unix.c
index b34c316..57ea4d9 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4094,8 +4094,17 @@
++*argc;
while (*p != NUL && (inquote || (*p != ' ' && *p != TAB)))
{
- if (*p == '"')
+ if (p[0] == '"')
inquote = !inquote;
+ else if (p[0] == '\\' && p[1] != NUL)
+ {
+ /* First pass: skip over "\ " and "\"".
+ * Second pass: Remove the backslash. */
+ if (i == 1)
+ mch_memmove(p, p + 1, STRLEN(p));
+ else
+ ++p;
+ }
++p;
}
if (*p == NUL)