• R/O
  • SSH

vim: Commit

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


Commit MetaInfo

Revisionc89903e16772bebee28ec935f7459c8c83bdf05e (tree)
Time2008-01-13 21:54:11
Authorvimboss
Commitervimboss

Log Message

updated for version 7.1-223

Change Summary

Incremental Difference

diff -r a6776e2c9f01 -r c89903e16772 src/os_unix.c
--- a/src/os_unix.c Sun Jan 13 12:31:34 2008 +0000
+++ b/src/os_unix.c Sun Jan 13 12:54:11 2008 +0000
@@ -4946,6 +4946,9 @@
49464946 char_u *p;
49474947 int dir;
49484948 #ifdef __EMX__
4949+ /*
4950+ * This is the OS/2 implementation.
4951+ */
49494952 # define EXPL_ALLOC_INC 16
49504953 char_u **expl_files;
49514954 size_t files_alloced, files_free;
@@ -5056,20 +5059,26 @@
50565059 return OK;
50575060
50585061 #else /* __EMX__ */
5059-
5062+ /*
5063+ * This is the non-OS/2 implementation (really Unix).
5064+ */
50605065 int j;
50615066 char_u *tempname;
50625067 char_u *command;
50635068 FILE *fd;
50645069 char_u *buffer;
5065-#define STYLE_ECHO 0 /* use "echo" to expand */
5066-#define STYLE_GLOB 1 /* use "glob" to expand, for csh */
5067-#define STYLE_PRINT 2 /* use "print -N" to expand, for zsh */
5068-#define STYLE_BT 3 /* `cmd` expansion, execute the pattern directly */
5070+#define STYLE_ECHO 0 /* use "echo", the default */
5071+#define STYLE_GLOB 1 /* use "glob", for csh */
5072+#define STYLE_VIMGLOB 2 /* use "vimglob", for Posix sh */
5073+#define STYLE_PRINT 3 /* use "print -N", for zsh */
5074+#define STYLE_BT 4 /* `cmd` expansion, execute the pattern
5075+ * directly */
50695076 int shell_style = STYLE_ECHO;
50705077 int check_spaces;
50715078 static int did_find_nul = FALSE;
50725079 int ampersent = FALSE;
5080+ /* vimglob() function to define for Posix shell */
5081+ static char *sh_vimglob_func = "vimglob() { while [ $# -ge 1 ]; do echo -n \"$1\"; echo; shift; done }; vimglob >";
50735082
50745083 *num_file = 0; /* default: no files found */
50755084 *file = NULL;
@@ -5107,9 +5116,17 @@
51075116
51085117 /*
51095118 * Let the shell expand the patterns and write the result into the temp
5110- * file. if expanding `cmd` execute it directly.
5111- * If we use csh, glob will work better than echo.
5112- * If we use zsh, print -N will work better than glob.
5119+ * file.
5120+ * STYLE_BT: NL separated
5121+ * If expanding `cmd` execute it directly.
5122+ * STYLE_GLOB: NUL separated
5123+ * If we use *csh, "glob" will work better than "echo".
5124+ * STYLE_PRINT: NL or NUL separated
5125+ * If we use *zsh, "print -N" will work better than "glob".
5126+ * STYLE_VIMGLOB: NL separated
5127+ * If we use *sh*, we define "vimglob()".
5128+ * STYLE_ECHO: space separated.
5129+ * A shell we don't know, stay safe and use "echo".
51135130 */
51145131 if (num_pat == 1 && *pat[0] == '`'
51155132 && (len = STRLEN(pat[0])) > 2
@@ -5122,9 +5139,17 @@
51225139 else if (STRCMP(p_sh + len - 3, "zsh") == 0)
51235140 shell_style = STYLE_PRINT;
51245141 }
5125-
5126- /* "unset nonomatch; print -N >" plus two is 29 */
5142+ if (shell_style == STYLE_ECHO && strstr((char *)gettail(p_sh),
5143+ "sh") != NULL)
5144+ shell_style = STYLE_VIMGLOB;
5145+
5146+ /* Compute the length of the command. We need 2 extra bytes: for the
5147+ * optional '&' and for the NUL.
5148+ * Worst case: "unset nonomatch; print -N >" plus two is 29 */
51275149 len = STRLEN(tempname) + 29;
5150+ if (shell_style == STYLE_VIMGLOB)
5151+ len += STRLEN(sh_vimglob_func);
5152+
51285153 for (i = 0; i < num_pat; ++i)
51295154 {
51305155 /* Count the length of the patterns in the same way as they are put in
@@ -5183,10 +5208,14 @@
51835208 STRCAT(command, "glob >");
51845209 else if (shell_style == STYLE_PRINT)
51855210 STRCAT(command, "print -N >");
5211+ else if (shell_style == STYLE_VIMGLOB)
5212+ STRCAT(command, sh_vimglob_func);
51865213 else
51875214 STRCAT(command, "echo >");
51885215 }
5216+
51895217 STRCAT(command, tempname);
5218+
51905219 if (shell_style != STYLE_BT)
51915220 for (i = 0; i < num_pat; ++i)
51925221 {
@@ -5232,8 +5261,7 @@
52325261 if (flags & EW_SILENT)
52335262 show_shell_mess = FALSE;
52345263 if (ampersent)
5235- STRCAT(command, "&"); /* put the '&' back after the
5236- redirection */
5264+ STRCAT(command, "&"); /* put the '&' after the redirection */
52375265
52385266 /*
52395267 * Using zsh -G: If a pattern has no matches, it is just deleted from
@@ -5265,7 +5293,7 @@
52655293 show_shell_mess = TRUE;
52665294 vim_free(command);
52675295
5268- if (i) /* mch_call_shell() failed */
5296+ if (i != 0) /* mch_call_shell() failed */
52695297 {
52705298 mch_remove(tempname);
52715299 vim_free(tempname);
@@ -5336,7 +5364,7 @@
53365364 }
53375365 vim_free(tempname);
53385366
5339-#if defined(__CYGWIN__) || defined(__CYGWIN32__)
5367+# if defined(__CYGWIN__) || defined(__CYGWIN32__)
53405368 /* Translate <CR><NL> into <NL>. Caution, buffer may contain NUL. */
53415369 p = buffer;
53425370 for (i = 0; i < len; ++i)
@@ -5359,7 +5387,7 @@
53595387 }
53605388 }
53615389 /* file names are separated with NL */
5362- else if (shell_style == STYLE_BT)
5390+ else if (shell_style == STYLE_BT || shell_style == STYLE_VIMGLOB)
53635391 {
53645392 buffer[len] = NUL; /* make sure the buffer ends in NUL */
53655393 p = buffer;
@@ -5438,7 +5466,8 @@
54385466 {
54395467 (*file)[i] = p;
54405468 /* Space or NL separates */
5441- if (shell_style == STYLE_ECHO || shell_style == STYLE_BT)
5469+ if (shell_style == STYLE_ECHO || shell_style == STYLE_BT
5470+ || shell_style == STYLE_VIMGLOB)
54425471 {
54435472 while (!(shell_style == STYLE_ECHO && *p == ' ')
54445473 && *p != '\n' && *p != NUL)
diff -r a6776e2c9f01 -r c89903e16772 src/version.c
--- a/src/version.c Sun Jan 13 12:31:34 2008 +0000
+++ b/src/version.c Sun Jan 13 12:54:11 2008 +0000
@@ -667,6 +667,8 @@
667667 static int included_patches[] =
668668 { /* Add new patch number below this line */
669669 /**/
670+ 223,
671+/**/
670672 222,
671673 /**/
672674 221,
Show on old repository browser