aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authorThomas Wienecke <wienecke.t@gmail.com>2014-03-06 14:21:02 +0100
committerThiago de Arruda <tpadilha84@gmail.com>2014-03-07 17:30:39 -0300
commitd5b223afe22b0809e4718749a3cdc40ceb5434dd (patch)
tree3b3beded2b841e76251ca3e9d92e37b8ca84e27a /src/os_unix.c
parent1468c12fd1b649644eeacd447dbb0865eb0cdb43 (diff)
downloadrneovim-d5b223afe22b0809e4718749a3cdc40ceb5434dd.tar.gz
rneovim-d5b223afe22b0809e4718749a3cdc40ceb5434dd.tar.bz2
rneovim-d5b223afe22b0809e4718749a3cdc40ceb5434dd.zip
Move mch_can_exe, executable_file to os/fs.c.
* Rename executable_file to is_executable.
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c65
1 files changed, 0 insertions, 65 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 5a01f07c36..3bbe056cc6 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1319,71 +1319,6 @@ void mch_hide(char_u *name)
/* can't hide a file */
}
-int executable_file(char_u *name);
-
-/*
- * Return 1 if "name" is an executable file, 0 if not or it doesn't exist.
- */
-int executable_file(char_u *name)
-{
- struct stat st;
-
- if (stat((char *)name, &st))
- return 0;
- return S_ISREG(st.st_mode) && mch_access((char *)name, X_OK) == 0;
-}
-
-/*
- * Return 1 if "name" can be found in $PATH and executed, 0 if not.
- * Return -1 if unknown.
- */
-int mch_can_exe(char_u *name)
-{
- char_u *buf;
- char_u *p, *e;
- int retval;
-
- /* If it's an absolute or relative path don't need to use $PATH. */
- if (mch_is_absolute_path(name) || (name[0] == '.' && (name[1] == '/'
- || (name[1] == '.' &&
- name[2] == '/'))))
- return executable_file(name);
-
- p = (char_u *)mch_getenv("PATH");
- if (p == NULL || *p == NUL)
- return -1;
- buf = alloc((unsigned)(STRLEN(name) + STRLEN(p) + 2));
- if (buf == NULL)
- return -1;
-
- /*
- * Walk through all entries in $PATH to check if "name" exists there and
- * is an executable file.
- */
- for (;; ) {
- e = (char_u *)strchr((char *)p, ':');
- if (e == NULL)
- e = p + STRLEN(p);
- if (e - p <= 1) /* empty entry means current dir */
- STRCPY(buf, "./");
- else {
- vim_strncpy(buf, p, e - p);
- add_pathsep(buf);
- }
- STRCAT(buf, name);
- retval = executable_file(buf);
- if (retval == 1)
- break;
-
- if (*e != ':')
- break;
- p = e + 1;
- }
-
- vim_free(buf);
- return retval;
-}
-
/*
* Check what "name" is:
* NODE_NORMAL: file or directory (or doesn't exist)