• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision553c97222cc0d0adb7beecd6f73be1c512f2f37c (tree)
Time2008-07-17 05:43:37
Authorvimboss
Commitervimboss

Log Message

updated for version 7.2b-005

Change Summary

Incremental Difference

diff -r fddea6c03dee -r 553c97222cc0 src/misc2.c
--- a/src/misc2.c Mon Jul 14 21:05:15 2008 +0000
+++ b/src/misc2.c Wed Jul 16 20:43:37 2008 +0000
@@ -1262,7 +1262,9 @@
12621262 * Escape "string" for use as a shell argument with system().
12631263 * This uses single quotes, except when we know we need to use double qoutes
12641264 * (MS-DOS and MS-Windows without 'shellslash' set).
1265- * Also replace "%", "#" and things like "<cfile>" when "do_special" is TRUE.
1265+ * Escape a newline, depending on the 'shell' option.
1266+ * When "do_special" is TRUE also replace "!", "%", "#" and things starting
1267+ * with "<" like "<cfile>".
12661268 * Returns the result in allocated memory, NULL if we have run out.
12671269 */
12681270 char_u *
@@ -1275,6 +1277,13 @@
12751277 char_u *d;
12761278 char_u *escaped_string;
12771279 int l;
1280+ int csh_like;
1281+
1282+ /* Only csh and similar shells expand '!' within single quotes. For sh and
1283+ * the like we must not put a backslash before it, it will be taken
1284+ * literally. If do_special is set the '!' will be escaped twice.
1285+ * Csh also needs to have "\n" escaped twice when do_special is set. */
1286+ csh_like = (strstr((char *)gettail(p_sh), "csh") != NULL);
12781287
12791288 /* First count the number of extra bytes required. */
12801289 length = (unsigned)STRLEN(string) + 3; /* two quotes and a trailing NUL */
@@ -1290,6 +1299,12 @@
12901299 # endif
12911300 if (*p == '\'')
12921301 length += 3; /* ' => '\'' */
1302+ if (*p == '\n' || (*p == '!' && (csh_like || do_special)))
1303+ {
1304+ ++length; /* insert backslash */
1305+ if (csh_like && do_special)
1306+ ++length; /* insert backslash */
1307+ }
12931308 if (do_special && find_cmdline_var(p, &l) >= 0)
12941309 {
12951310 ++length; /* insert backslash */
@@ -1335,6 +1350,14 @@
13351350 ++p;
13361351 continue;
13371352 }
1353+ if (*p == '\n' || (*p == '!' && (csh_like || do_special)))
1354+ {
1355+ *d++ = '\\';
1356+ if (csh_like && do_special)
1357+ *d++ = '\\';
1358+ *d++ = *p++;
1359+ continue;
1360+ }
13381361 if (do_special && find_cmdline_var(p, &l) >= 0)
13391362 {
13401363 *d++ = '\\'; /* insert backslash */
diff -r fddea6c03dee -r 553c97222cc0 src/version.c
--- a/src/version.c Mon Jul 14 21:05:15 2008 +0000
+++ b/src/version.c Wed Jul 16 20:43:37 2008 +0000
@@ -677,6 +677,8 @@
677677 static int included_patches[] =
678678 { /* Add new patch number below this line */
679679 /**/
680+ 5,
681+/**/
680682 4,
681683 /**/
682684 3,
Show on old repository browser