diff options
| author | Thomas Wienecke <wienecke.t@gmail.com> | 2014-03-27 12:38:33 +0100 |
|---|---|---|
| committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-27 19:57:55 -0300 |
| commit | 5762c4e528cbd6629319bf3958d1f6554b399b20 (patch) | |
| tree | 3be91959012944534451ec84584ff4be84286b7c /src/os | |
| parent | 3f7011ab9185b4968e89086f77b054161a900beb (diff) | |
| download | rneovim-5762c4e528cbd6629319bf3958d1f6554b399b20.tar.gz rneovim-5762c4e528cbd6629319bf3958d1f6554b399b20.tar.bz2 rneovim-5762c4e528cbd6629319bf3958d1f6554b399b20.zip | |
Rename mch_* functions to os_* in os module.
Diffstat (limited to 'src/os')
| -rw-r--r-- | src/os/env.c | 6 | ||||
| -rw-r--r-- | src/os/fs.c | 40 | ||||
| -rw-r--r-- | src/os/input.c | 6 | ||||
| -rw-r--r-- | src/os/input.h | 6 | ||||
| -rw-r--r-- | src/os/mem.c | 2 | ||||
| -rw-r--r-- | src/os/os.h | 32 | ||||
| -rw-r--r-- | src/os/time.c | 6 | ||||
| -rw-r--r-- | src/os/time.h | 2 | ||||
| -rw-r--r-- | src/os/users.c | 10 |
9 files changed, 55 insertions, 55 deletions
diff --git a/src/os/env.c b/src/os/env.c index 546caa50b8..91b27e67a9 100644 --- a/src/os/env.c +++ b/src/os/env.c @@ -20,17 +20,17 @@ #include <crt_externs.h> #endif -const char *mch_getenv(const char *name) +const char *os_getenv(const char *name) { return getenv(name); } -int mch_setenv(const char *name, const char *value, int overwrite) +int os_setenv(const char *name, const char *value, int overwrite) { return setenv(name, value, overwrite); } -char *mch_getenvname_at_index(size_t index) +char *os_getenvname_at_index(size_t index) { # if defined(AMIGA) || defined(__MRC__) || defined(__SC__) /* 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, diff --git a/src/os/input.c b/src/os/input.c index dd7d123536..2f4b42467b 100644 --- a/src/os/input.c +++ b/src/os/input.c @@ -122,7 +122,7 @@ uint32_t input_read(char *buf, uint32_t count) /* Low level input function. */ -int mch_inchar(char_u *buf, int maxlen, long ms, int tb_change_cnt) +int os_inchar(char_u *buf, int maxlen, long ms, int tb_change_cnt) { InbufPollResult result; @@ -158,7 +158,7 @@ int mch_inchar(char_u *buf, int maxlen, long ms, int tb_change_cnt) } /* Check if a character is available for reading */ -bool mch_char_avail() +bool os_char_avail() { return inbuf_poll(0) == kInputAvail; } @@ -167,7 +167,7 @@ bool mch_char_avail() * Check for CTRL-C typed by reading all available characters. * In cooked mode we should get SIGINT, no need to check. */ -void mch_breakcheck() +void os_breakcheck() { if (curr_tmode == TMODE_RAW && event_poll(0)) fill_input_buf(FALSE); diff --git a/src/os/input.h b/src/os/input.h index a48769e843..2493225622 100644 --- a/src/os/input.h +++ b/src/os/input.h @@ -11,9 +11,9 @@ bool input_ready(void); void input_start(void); void input_stop(void); uint32_t input_read(char *buf, uint32_t count); -int mch_inchar(char_u *, int, long, int); -bool mch_char_avail(void); -void mch_breakcheck(void); +int os_inchar(char_u *, int, long, int); +bool os_char_avail(void); +void os_breakcheck(void); #endif diff --git a/src/os/mem.c b/src/os/mem.c index fa93fe8398..037b5931e4 100644 --- a/src/os/mem.c +++ b/src/os/mem.c @@ -19,7 +19,7 @@ * Return total amount of memory available in Kbyte. * Doesn't change when memory has been allocated. */ -long_u mch_total_mem(int special) { +long_u os_total_mem(int special) { /* We need to return memory in *Kbytes* but uv_get_total_memory() returns the * number of bytes of total memory. */ return uv_get_total_memory() >> 10; diff --git a/src/os/os.h b/src/os/os.h index 0a6bb067e2..3510fad9ca 100644 --- a/src/os/os.h +++ b/src/os/os.h @@ -3,22 +3,22 @@ #include "vim.h" -long_u mch_total_mem(int special); -int mch_chdir(char *path); -int mch_dirname(char_u *buf, size_t len); -int mch_get_absolute_path(char_u *fname, char_u *buf, int len, int force); -int mch_is_absolute_path(const char_u *fname); -int mch_isdir(const char_u *name); -int mch_can_exe(const char_u *name); -const char *mch_getenv(const char *name); -int mch_setenv(const char *name, const char *value, int overwrite); -char *mch_getenvname_at_index(size_t index); -int mch_get_usernames(garray_T *usernames); -int mch_get_user_name(char *s, size_t len); -int mch_get_uname(uid_t uid, char *s, size_t len); -char *mch_get_user_directory(const char *name); -long mch_getperm(const char_u *name); -int mch_setperm(const char_u *name, int perm); +long_u os_total_mem(int special); +int os_chdir(char *path); +int os_dirname(char_u *buf, size_t len); +int os_get_absolute_path(char_u *fname, char_u *buf, int len, int force); +int os_is_absolute_path(const char_u *fname); +int os_isdir(const char_u *name); +int os_can_exe(const char_u *name); +const char *os_getenv(const char *name); +int os_setenv(const char *name, const char *value, int overwrite); +char *os_getenvname_at_index(size_t index); +int os_get_usernames(garray_T *usernames); +int os_get_user_name(char *s, size_t len); +int os_get_uname(uid_t uid, char *s, size_t len); +char *os_get_user_directory(const char *name); +long os_getperm(const char_u *name); +int os_setperm(const char_u *name, int perm); int os_file_exists(char_u *name); #endif diff --git a/src/os/time.c b/src/os/time.c index bb86806af3..f14a69264e 100644 --- a/src/os/time.c +++ b/src/os/time.c @@ -17,7 +17,7 @@ void time_init() uv_cond_init(&delay_cond); } -void mch_delay(uint64_t ms, bool ignoreinput) +void os_delay(uint64_t ms, bool ignoreinput) { int old_tmode; @@ -25,7 +25,7 @@ void mch_delay(uint64_t ms, bool ignoreinput) /* Go to cooked mode without echo, to allow SIGINT interrupting us * here. But we don't want QUIT to kill us (CTRL-\ used in a * shell may produce SIGQUIT). */ - in_mch_delay = true; + in_os_delay = true; old_tmode = curr_tmode; if (curr_tmode == TMODE_RAW) @@ -34,7 +34,7 @@ void mch_delay(uint64_t ms, bool ignoreinput) delay(ms); settmode(old_tmode); - in_mch_delay = false; + in_os_delay = false; } else { delay(ms); } diff --git a/src/os/time.h b/src/os/time.h index 503c218349..1511977a3e 100644 --- a/src/os/time.h +++ b/src/os/time.h @@ -5,7 +5,7 @@ #include <stdbool.h> void time_init(void); -void mch_delay(uint64_t ms, bool ignoreinput); +void os_delay(uint64_t ms, bool ignoreinput); #endif diff --git a/src/os/users.c b/src/os/users.c index 2104d8080e..32bc4bb476 100644 --- a/src/os/users.c +++ b/src/os/users.c @@ -24,7 +24,7 @@ * Initialize users garray and fill it with os usernames. * Return Ok for success, FAIL for failure. */ -int mch_get_usernames(garray_T *users) +int os_get_usernames(garray_T *users) { if (users == NULL) { return FALSE; @@ -59,9 +59,9 @@ int mch_get_usernames(garray_T *users) * Insert user name in s[len]. * Return OK if a name found. */ -int mch_get_user_name(char *s, size_t len) +int os_get_user_name(char *s, size_t len) { - return mch_get_uname(getuid(), s, len); + return os_get_uname(getuid(), s, len); } /* @@ -69,7 +69,7 @@ int mch_get_user_name(char *s, size_t len) * Return OK if a name found. * If the name is not found, write the uid into s[len] and return FAIL. */ -int mch_get_uname(uid_t uid, char *s, size_t len) +int os_get_uname(uid_t uid, char *s, size_t len) { #if defined(HAVE_PWD_H) && defined(HAVE_GETPWUID) struct passwd *pw; @@ -89,7 +89,7 @@ int mch_get_uname(uid_t uid, char *s, size_t len) * The caller has to free() the returned string. * If the username is not found, NULL is returned. */ -char *mch_get_user_directory(const char *name) +char *os_get_user_directory(const char *name) { #if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H) struct passwd *pw; |