Karsten Hopp 404aa2
To: vim_dev@googlegroups.com
Karsten Hopp 404aa2
Subject: Patch 7.3.269
Karsten Hopp 404aa2
Fcc: outbox
Karsten Hopp 404aa2
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 404aa2
Mime-Version: 1.0
Karsten Hopp 404aa2
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 404aa2
Content-Transfer-Encoding: 8bit
Karsten Hopp 404aa2
------------
Karsten Hopp 404aa2
Karsten Hopp 404aa2
Patch 7.3.269
Karsten Hopp 404aa2
Problem:    'shellcmdflag' only works with one flag. 
Karsten Hopp 404aa2
Solution:   Split into multiple arguments. (Gary Johnson)
Karsten Hopp 404aa2
Files:	    src/os_unix.c
Karsten Hopp 404aa2
Karsten Hopp 404aa2
Karsten Hopp 404aa2
*** ../vim-7.3.268/src/os_unix.c	2011-08-04 19:36:47.000000000 +0200
Karsten Hopp 404aa2
--- src/os_unix.c	2011-08-04 20:27:13.000000000 +0200
Karsten Hopp 404aa2
***************
Karsten Hopp 404aa2
*** 3795,3802 ****
Karsten Hopp 404aa2
--- 3795,3804 ----
Karsten Hopp 404aa2
      int		retval = -1;
Karsten Hopp 404aa2
      char	**argv = NULL;
Karsten Hopp 404aa2
      int		argc;
Karsten Hopp 404aa2
+     char_u	*p_shcf_copy = NULL;
Karsten Hopp 404aa2
      int		i;
Karsten Hopp 404aa2
      char_u	*p;
Karsten Hopp 404aa2
+     char_u	*s;
Karsten Hopp 404aa2
      int		inquote;
Karsten Hopp 404aa2
      int		pty_master_fd = -1;	    /* for pty's */
Karsten Hopp 404aa2
  # ifdef FEAT_GUI
Karsten Hopp 404aa2
***************
Karsten Hopp 404aa2
*** 3855,3860 ****
Karsten Hopp 404aa2
--- 3857,3875 ----
Karsten Hopp 404aa2
  	}
Karsten Hopp 404aa2
  	if (argv == NULL)
Karsten Hopp 404aa2
  	{
Karsten Hopp 404aa2
+ 	    /*
Karsten Hopp 404aa2
+ 	     * Account for possible multiple args in p_shcf.
Karsten Hopp 404aa2
+ 	     */
Karsten Hopp 404aa2
+ 	    p = p_shcf;
Karsten Hopp 404aa2
+ 	    for (;;)
Karsten Hopp 404aa2
+ 	    {
Karsten Hopp 404aa2
+ 		p = skiptowhite(p);
Karsten Hopp 404aa2
+ 		if (*p == NUL)
Karsten Hopp 404aa2
+ 		    break;
Karsten Hopp 404aa2
+ 		++argc;
Karsten Hopp 404aa2
+ 		p = skipwhite(p);
Karsten Hopp 404aa2
+ 	    }
Karsten Hopp 404aa2
+ 
Karsten Hopp 404aa2
  	    argv = (char **)alloc((unsigned)((argc + 4) * sizeof(char *)));
Karsten Hopp 404aa2
  	    if (argv == NULL)	    /* out of memory */
Karsten Hopp 404aa2
  		goto error;
Karsten Hopp 404aa2
***************
Karsten Hopp 404aa2
*** 3864,3870 ****
Karsten Hopp 404aa2
      {
Karsten Hopp 404aa2
  	if (extra_shell_arg != NULL)
Karsten Hopp 404aa2
  	    argv[argc++] = (char *)extra_shell_arg;
Karsten Hopp 404aa2
! 	argv[argc++] = (char *)p_shcf;
Karsten Hopp 404aa2
  	argv[argc++] = (char *)cmd;
Karsten Hopp 404aa2
      }
Karsten Hopp 404aa2
      argv[argc] = NULL;
Karsten Hopp 404aa2
--- 3879,3901 ----
Karsten Hopp 404aa2
      {
Karsten Hopp 404aa2
  	if (extra_shell_arg != NULL)
Karsten Hopp 404aa2
  	    argv[argc++] = (char *)extra_shell_arg;
Karsten Hopp 404aa2
! 
Karsten Hopp 404aa2
! 	/* Break 'shellcmdflag' into white separated parts.  This doesn't
Karsten Hopp 404aa2
! 	 * handle quoted strings, they are very unlikely to appear. */
Karsten Hopp 404aa2
! 	p_shcf_copy = alloc((unsigned)STRLEN(p_shcf) + 1);
Karsten Hopp 404aa2
! 	if (p_shcf_copy == NULL)    /* out of memory */
Karsten Hopp 404aa2
! 	    goto error;
Karsten Hopp 404aa2
! 	s = p_shcf_copy;
Karsten Hopp 404aa2
! 	p = p_shcf;
Karsten Hopp 404aa2
! 	while (*p != NUL)
Karsten Hopp 404aa2
! 	{
Karsten Hopp 404aa2
! 	    argv[argc++] = (char *)s;
Karsten Hopp 404aa2
! 	    while (*p && *p != ' ' && *p != TAB)
Karsten Hopp 404aa2
! 		*s++ = *p++;
Karsten Hopp 404aa2
! 	    *s++ = NUL;
Karsten Hopp 404aa2
! 	    p = skipwhite(p);
Karsten Hopp 404aa2
! 	}
Karsten Hopp 404aa2
! 
Karsten Hopp 404aa2
  	argv[argc++] = (char *)cmd;
Karsten Hopp 404aa2
      }
Karsten Hopp 404aa2
      argv[argc] = NULL;
Karsten Hopp 404aa2
***************
Karsten Hopp 404aa2
*** 4677,4682 ****
Karsten Hopp 404aa2
--- 4708,4714 ----
Karsten Hopp 404aa2
  	}
Karsten Hopp 404aa2
      }
Karsten Hopp 404aa2
      vim_free(argv);
Karsten Hopp 404aa2
+     vim_free(p_shcf_copy);
Karsten Hopp 404aa2
  
Karsten Hopp 404aa2
  error:
Karsten Hopp 404aa2
      if (!did_settmode)
Karsten Hopp 404aa2
*** ../vim-7.3.268/src/version.c	2011-08-04 19:36:47.000000000 +0200
Karsten Hopp 404aa2
--- src/version.c	2011-08-04 20:30:44.000000000 +0200
Karsten Hopp 404aa2
***************
Karsten Hopp 404aa2
*** 711,712 ****
Karsten Hopp 404aa2
--- 711,714 ----
Karsten Hopp 404aa2
  {   /* Add new patch number below this line */
Karsten Hopp 404aa2
+ /**/
Karsten Hopp 404aa2
+     269,
Karsten Hopp 404aa2
  /**/
Karsten Hopp 404aa2
Karsten Hopp 404aa2
-- 
Karsten Hopp 404aa2
Be nice to your kids...  they'll be the ones choosing your nursing home.
Karsten Hopp 404aa2
Karsten Hopp 404aa2
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 404aa2
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 404aa2
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 404aa2
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///