summaryrefslogtreecommitdiffstats
path: root/src/if_cscope.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-05 22:33:28 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-05 22:33:28 +0200
commitaf7645d3733fdd3cd2df03ec7b653601d26969ef (patch)
tree1b3c3d1d0d6428c33026693a5086910cca8b3078 /src/if_cscope.c
parent8d3b51084a5bdcd2ee9e31bc03cba0d16c43d428 (diff)
patch 8.1.1989: the evalfunc.c file is still too bigv8.1.1989
Problem: The evalfunc.c file is still too big. Solution: Move f_pathshorten() to filepath.c. Move f_cscope_connection() to if_cscope.c. Move diff_ functions to diff.c. Move timer_ functions to ex_cmds2.c. move callback functions to evalvars.c.
Diffstat (limited to 'src/if_cscope.c')
-rw-r--r--src/if_cscope.c32
1 files changed, 30 insertions, 2 deletions
diff --git a/src/if_cscope.c b/src/if_cscope.c
index 2cc25b7439..4f359ee55c 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -384,7 +384,7 @@ cs_print_tags(void)
* Note: All string comparisons are case sensitive!
*/
#if defined(FEAT_EVAL) || defined(PROTO)
- int
+ static int
cs_connection(int num, char_u *dbpath, char_u *ppath)
{
int i;
@@ -430,7 +430,35 @@ cs_connection(int num, char_u *dbpath, char_u *ppath)
}
return FALSE;
-} /* cs_connection */
+}
+
+/*
+ * "cscope_connection([{num} , {dbpath} [, {prepend}]])" function
+ *
+ * Checks the existence of a cscope connection.
+ */
+ void
+f_cscope_connection(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
+{
+#ifdef FEAT_CSCOPE
+ int num = 0;
+ char_u *dbpath = NULL;
+ char_u *prepend = NULL;
+ char_u buf[NUMBUFLEN];
+
+ if (argvars[0].v_type != VAR_UNKNOWN
+ && argvars[1].v_type != VAR_UNKNOWN)
+ {
+ num = (int)tv_get_number(&argvars[0]);
+ dbpath = tv_get_string(&argvars[1]);
+ if (argvars[2].v_type != VAR_UNKNOWN)
+ prepend = tv_get_string_buf(&argvars[2], buf);
+ }
+
+ rettv->vval.v_number = cs_connection(num, dbpath, prepend);
+#endif
+}
+
#endif