aboutsummaryrefslogtreecommitdiff
path: root/src/os/fs.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os/fs.c')
-rw-r--r--src/os/fs.c40
1 files changed, 20 insertions, 20 deletions
diff --git a/src/os/fs.c b/src/os/fs.c
index cb03a26e2a..2207cdbab6 100644
--- a/src/os/fs.c
+++ b/src/os/fs.c
@@ -18,7 +18,7 @@
#include "misc1.h"
#include "misc2.h"
-int mch_chdir(char *path) {
+int os_chdir(char *path) {
if (p_verbose >= 5) {
verbose_enter();
smsg((char_u *)"chdir(%s)", path);
@@ -31,7 +31,7 @@ int mch_chdir(char *path) {
* Get name of current directory into buffer 'buf' of length 'len' bytes.
* Return OK for success, FAIL for failure.
*/
-int mch_dirname(char_u *buf, size_t len)
+int os_dirname(char_u *buf, size_t len)
{
assert(buf && len);
@@ -49,37 +49,37 @@ int mch_dirname(char_u *buf, size_t len)
* parameter directory: Directory name, relative to current directory.
* return FAIL for failure, OK for success
*/
-int mch_full_dir_name(char *directory, char *buffer, int len)
+int os_full_dir_name(char *directory, char *buffer, int len)
{
int retval = OK;
if(STRLEN(directory) == 0) {
- return mch_dirname((char_u *) buffer, len);
+ return os_dirname((char_u *) buffer, len);
}
char old_dir[MAXPATHL];
/* Get current directory name. */
- if (mch_dirname((char_u *) old_dir, MAXPATHL) == FAIL) {
+ if (os_dirname((char_u *) old_dir, MAXPATHL) == FAIL) {
return FAIL;
}
/* We have to get back to the current dir at the end, check if that works. */
- if (mch_chdir(old_dir) != 0) {
+ if (os_chdir(old_dir) != 0) {
return FAIL;
}
- if (mch_chdir(directory) != 0) {
+ if (os_chdir(directory) != 0) {
/* Do not return immediatly since we may be in the wrong directory. */
retval = FAIL;
}
- if (retval == FAIL || mch_dirname((char_u *) buffer, len) == FAIL) {
+ if (retval == FAIL || os_dirname((char_u *) buffer, len) == FAIL) {
/* Do not return immediatly since we are in the wrong directory. */
retval = FAIL;
}
- if (mch_chdir(old_dir) != 0) {
+ if (os_chdir(old_dir) != 0) {
/* That shouldn't happen, since we've tested if it works. */
retval = FAIL;
EMSG(_(e_prev_dir));
@@ -135,7 +135,7 @@ int append_path(char *path, const char *to_append, int max_len)
*
* return FAIL for failure, OK for success
*/
-int mch_get_absolute_path(char_u *fname, char_u *buf, int len, int force)
+int os_get_absolute_path(char_u *fname, char_u *buf, int len, int force)
{
char_u *p;
*buf = NUL;
@@ -144,7 +144,7 @@ int mch_get_absolute_path(char_u *fname, char_u *buf, int len, int force)
char *end_of_path = (char *) fname;
/* expand it if forced or not an absolute path */
- if (force || !mch_is_absolute_path(fname)) {
+ if (force || !os_is_absolute_path(fname)) {
if ((p = vim_strrchr(fname, '/')) != NULL) {
STRNCPY(relative_directory, fname, p-fname);
@@ -155,7 +155,7 @@ int mch_get_absolute_path(char_u *fname, char_u *buf, int len, int force)
end_of_path = (char *) fname;
}
- if (FAIL == mch_full_dir_name(relative_directory, (char *) buf, len)) {
+ if (FAIL == os_full_dir_name(relative_directory, (char *) buf, len)) {
return FAIL;
}
}
@@ -165,7 +165,7 @@ int mch_get_absolute_path(char_u *fname, char_u *buf, int len, int force)
/*
* Return TRUE if "fname" does not depend on the current directory.
*/
-int mch_is_absolute_path(const char_u *fname)
+int os_is_absolute_path(const char_u *fname)
{
return *fname == '/' || *fname == '~';
}
@@ -175,9 +175,9 @@ int mch_is_absolute_path(const char_u *fname)
* return FALSE if "name" is not a directory
* return FALSE for error
*/
-int mch_isdir(const char_u *name)
+int os_isdir(const char_u *name)
{
- long mode = mch_getperm(name);
+ long mode = os_getperm(name);
if (mode < 0) {
return FALSE;
}
@@ -196,10 +196,10 @@ static int is_executable_in_path(const char_u *name);
* Return TRUE if "name" is executable and can be found in $PATH, is absolute
* or relative to current dir, FALSE if not.
*/
-int mch_can_exe(const char_u *name)
+int os_can_exe(const char_u *name)
{
/* If it's an absolute or relative path don't need to use $PATH. */
- if (mch_is_absolute_path(name) ||
+ if (os_is_absolute_path(name) ||
(name[0] == '.' && (name[1] == '/' ||
(name[1] == '.' && name[2] == '/')))) {
return is_executable(name);
@@ -214,7 +214,7 @@ int mch_can_exe(const char_u *name)
*/
static int is_executable(const char_u *name)
{
- long mode = mch_getperm(name);
+ long mode = os_getperm(name);
if (mode < 0) {
return FALSE;
@@ -284,7 +284,7 @@ static int is_executable_in_path(const char_u *name)
* Get file permissions for 'name'.
* Returns -1 when it doesn't exist.
*/
-long mch_getperm(const char_u *name)
+long os_getperm(const char_u *name)
{
uv_fs_t request;
int result = uv_fs_stat(uv_default_loop(), &request, (const char*) name, NULL);
@@ -302,7 +302,7 @@ long mch_getperm(const char_u *name)
* Set file permission for 'name' to 'perm'.
* Returns FAIL for failure, OK otherwise.
*/
-int mch_setperm(const char_u *name, int perm)
+int os_setperm(const char_u *name, int perm)
{
uv_fs_t request;
int result = uv_fs_chmod(uv_default_loop(), &request,