changeset 869:31bff9be0a77 v7.0g04

updated for version 7.0g04
author vimboss
date Fri, 05 May 2006 21:18:03 +0000
parents 95c5a7508d2d
children 591fb953a280
files src/eval.c
diffstat 1 files changed, 13 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/eval.c
+++ b/src/eval.c
@@ -8791,7 +8791,11 @@ f_exists(argvars, rettv)
 	}
     }
     else if (*p == '&' || *p == '+')			/* option */
+    {
 	n = (get_option_tv(&p, NULL, TRUE) == OK);
+	if (*skipwhite(p) != NUL)
+	    n = FALSE;			/* trailing garbage */
+    }
     else if (*p == '*')			/* internal or user defined function */
     {
 	n = function_exists(p + 1);
@@ -8830,6 +8834,8 @@ f_exists(argvars, rettv)
 		    clear_tv(&tv);
 	    }
 	}
+	if (*p != NUL)
+	    n = FALSE;
 
 	vim_free(tofree);
     }
@@ -19109,14 +19115,18 @@ function_exists(name)
     int	    n = FALSE;
 
     p = trans_function_name(&nm, FALSE, TFN_INT|TFN_QUIET, NULL);
-    if (p != NULL)
+    nm = skipwhite(nm);
+
+    /* Only accept "funcname", "funcname ", "funcname (..." and
+     * "funcname(...", not "funcname!...". */
+    if (p != NULL && (*nm == NUL || *nm == '('))
     {
 	if (builtin_function(p))
 	    n = (find_internal_func(p) >= 0);
 	else
 	    n = (find_func(p) != NULL);
-	vim_free(p);
-    }
+    }
+    vim_free(p);
     return n;
 }