diff src/misc1.c @ 5867:a6b59ee633a3 v7.4.276

updated for version 7.4.276 Problem: The fish shell is not supported. Solution: Use begin/end instead of () for fish. (Andy Russell)
author Bram Moolenaar <bram@vim.org>
date Wed, 07 May 2014 15:10:21 +0200
parents e5f1f2ea0b4a
children 8e9db1f27a00
line wrap: on
line diff
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -1405,7 +1405,7 @@ open_line(dir, flags, second_line_indent
 #ifdef FEAT_SMARTINDENT
 	if (did_si)
 	{
-	    int        sw = (int)get_sw_value(curbuf);
+	    int sw = (int)get_sw_value(curbuf);
 
 	    if (p_sr)
 		newindent -= newindent % sw;
@@ -10896,3 +10896,41 @@ goto_im()
 {
     return (p_im && stuff_empty() && typebuf_typed());
 }
+
+/*
+ * Returns the isolated name of the shell:
+ * - Skip beyond any path.  E.g., "/usr/bin/csh -f" -> "csh -f".
+ * - Remove any argument.  E.g., "csh -f" -> "csh".
+ * But don't allow a space in the path, so that this works:
+ *   "/usr/bin/csh --rcfile ~/.cshrc"
+ * But don't do that for Windows, it's common to have a space in the path.
+ */
+    char_u *
+get_isolated_shell_name()
+{
+    char_u *p;
+
+#ifdef WIN3264
+    p = gettail(p_sh);
+    p = vim_strnsave(p, (int)(skiptowhite(p) - p));
+#else
+    p = skiptowhite(p_sh);
+    if (*p == NUL)
+    {
+	/* No white space, use the tail. */
+	p = vim_strsave(gettail(p_sh));
+    }
+    else
+    {
+	char_u  *p1, *p2;
+
+	/* Find the last path separator before the space. */
+	p1 = p_sh;
+	for (p2 = p_sh; p2 < p; mb_ptr_adv(p2))
+	    if (vim_ispathsep(*p2))
+		p1 = p2 + 1;
+	p = vim_strnsave(p1, (int)(p - p1));
+    }
+#endif
+    return p;
+}