aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/os')
-rw-r--r--src/nvim/os/env.c24
-rw-r--r--src/nvim/os/fs.c18
-rw-r--r--src/nvim/os/os_defs.h4
-rw-r--r--src/nvim/os/process.c8
-rw-r--r--src/nvim/os/pty_process.h2
-rw-r--r--src/nvim/os/signal.c4
-rw-r--r--src/nvim/os/stdpaths.c8
-rw-r--r--src/nvim/os/tty.c2
-rw-r--r--src/nvim/os/users.c4
-rw-r--r--src/nvim/os/win_defs.h2
10 files changed, 38 insertions, 38 deletions
diff --git a/src/nvim/os/env.c b/src/nvim/os/env.c
index bcc0fba8d0..bd79b43574 100644
--- a/src/nvim/os/env.c
+++ b/src/nvim/os/env.c
@@ -20,7 +20,7 @@
#include "nvim/version.h"
#include "nvim/vim.h"
-#ifdef WIN32
+#ifdef MSWIN
# include "nvim/mbyte.h" // for utf8_to_utf16, utf16_to_utf8
#endif
@@ -128,7 +128,7 @@ int os_setenv(const char *name, const char *value, int overwrite)
if (name[0] == '\0') {
return -1;
}
-#ifdef WIN32
+#ifdef MSWIN
if (!overwrite && os_getenv(name) != NULL) {
return 0;
}
@@ -143,7 +143,7 @@ int os_setenv(const char *name, const char *value, int overwrite)
#endif
uv_mutex_lock(&mutex);
int r;
-#ifdef WIN32
+#ifdef MSWIN
// libintl uses getenv() for LC_ALL/LANG/etc., so we must use _putenv_s().
if (striequal(name, "LC_ALL") || striequal(name, "LANGUAGE")
|| striequal(name, "LANG") || striequal(name, "LC_MESSAGES")) {
@@ -186,7 +186,7 @@ int os_unsetenv(const char *name)
size_t os_get_fullenv_size(void)
{
size_t len = 0;
-#ifdef _WIN32
+#ifdef MSWIN
wchar_t *envstrings = GetEnvironmentStringsW();
wchar_t *p = envstrings;
size_t l;
@@ -235,7 +235,7 @@ void os_free_fullenv(char **env)
/// @param env_size size of `env`, @see os_fullenv_size
void os_copy_fullenv(char **env, size_t env_size)
{
-#ifdef _WIN32
+#ifdef MSWIN
wchar_t *envstrings = GetEnvironmentStringsW();
if (!envstrings) {
return;
@@ -280,7 +280,7 @@ void os_copy_fullenv(char **env, size_t env_size)
/// @return [allocated] environment variable's value, or NULL
char *os_getenvname_at_index(size_t index)
{
-#ifdef _WIN32
+#ifdef MSWIN
wchar_t *envstrings = GetEnvironmentStringsW();
if (!envstrings) {
return NULL;
@@ -347,7 +347,7 @@ char *os_getenvname_at_index(size_t index)
/// @return the process ID.
int64_t os_get_pid(void)
{
-#ifdef _WIN32
+#ifdef MSWIN
return (int64_t)GetCurrentProcessId();
#else
return (int64_t)getpid();
@@ -368,7 +368,7 @@ void os_get_hostname(char *hostname, size_t size)
} else {
xstrlcpy(hostname, vutsname.nodename, size);
}
-#elif defined(WIN32)
+#elif defined(MSWIN)
wchar_t host_utf16[MAX_COMPUTERNAME_LENGTH + 1];
DWORD host_wsize = sizeof(host_utf16) / sizeof(host_utf16[0]);
if (GetComputerNameW(host_utf16, &host_wsize) == 0) {
@@ -418,7 +418,7 @@ void init_homedir(void)
const char *var = os_getenv("HOME");
-#ifdef WIN32
+#ifdef MSWIN
// Typically, $HOME is not defined on Windows, unless the user has
// specifically defined it for Vim's sake. However, on Windows NT
// platforms, $HOMEDRIVE and $HOMEPATH are automatically defined for
@@ -900,7 +900,7 @@ char *vim_getenv(const char *name)
// init_path() should have been called before now.
assert(get_vim_var_str(VV_PROGPATH)[0] != NUL);
-#ifdef WIN32
+#ifdef MSWIN
if (strcmp(name, "HOME") == 0) {
return xstrdup(homedir);
}
@@ -1056,7 +1056,7 @@ size_t home_replace(const buf_T *const buf, const char *src, char *const dst, si
}
const char *homedir_env = os_getenv("HOME");
-#ifdef WIN32
+#ifdef MSWIN
if (homedir_env == NULL) {
homedir_env = os_getenv("USERPROFILE");
}
@@ -1174,7 +1174,7 @@ char *get_env_name(expand_T *xp, int idx)
bool os_setenv_append_path(const char *fname)
FUNC_ATTR_NONNULL_ALL
{
-#ifdef WIN32
+#ifdef MSWIN
// 8191 (plus NUL) is considered the practical maximum.
# define MAX_ENVPATHLEN 8192
#else
diff --git a/src/nvim/os/fs.c b/src/nvim/os/fs.c
index 158c22efaf..68e96eea6e 100644
--- a/src/nvim/os/fs.c
+++ b/src/nvim/os/fs.c
@@ -27,7 +27,7 @@
#include "nvim/path.h"
#include "nvim/strings.h"
-#ifdef WIN32
+#ifdef MSWIN
# include "nvim/mbyte.h" // for utf8_to_utf16, utf16_to_utf8
#endif
@@ -151,7 +151,7 @@ bool os_isdir(const char *name)
int os_nodetype(const char *name)
FUNC_ATTR_NONNULL_ALL
{
-#ifndef WIN32 // Unix
+#ifndef MSWIN // Unix
uv_stat_t statbuf;
if (0 != os_stat(name, &statbuf)) {
return NODE_NORMAL; // File doesn't exist.
@@ -241,7 +241,7 @@ bool os_can_exe(const char *name, char **abspath, bool use_path)
FUNC_ATTR_NONNULL_ARG(1)
{
if (!use_path || gettail_dir(name) != name) {
-#ifdef WIN32
+#ifdef MSWIN
if (is_executable_ext(name, abspath)) {
#else
// Must have path separator, cannot execute files in the current directory.
@@ -270,7 +270,7 @@ static bool is_executable(const char *name, char **abspath)
return false;
}
-#ifdef WIN32
+#ifdef MSWIN
// Windows does not have exec bit; just check if the file exists and is not
// a directory.
const bool ok = S_ISREG(mode);
@@ -287,7 +287,7 @@ static bool is_executable(const char *name, char **abspath)
return ok;
}
-#ifdef WIN32
+#ifdef MSWIN
/// Checks if file `name` is executable under any of these conditions:
/// - extension is in $PATHEXT and `name` is executable
/// - result of any $PATHEXT extension appended to `name` is executable
@@ -351,7 +351,7 @@ static bool is_executable_in_path(const char *name, char **abspath)
return false;
}
-#ifdef WIN32
+#ifdef MSWIN
// Prepend ".;" to $PATH.
size_t pathlen = strlen(path_env);
char *path = memcpy(xmallocz(pathlen + 2), "." ENV_SEPSTR, 2);
@@ -374,7 +374,7 @@ static bool is_executable_in_path(const char *name, char **abspath)
STRLCPY(buf, p, e - p + 1);
append_path(buf, name, buf_len);
-#ifdef WIN32
+#ifdef MSWIN
if (is_executable_ext(buf, abspath)) {
#else
if (is_executable(buf, abspath)) {
@@ -446,7 +446,7 @@ FILE *os_fopen(const char *path, const char *flags)
default:
abort();
}
-#ifdef WIN32
+#ifdef MSWIN
if (flags[1] == 'b') {
iflags |= O_BINARY;
}
@@ -1208,7 +1208,7 @@ char *os_realpath(const char *name, char *buf)
return result == kLibuvSuccess ? buf : NULL;
}
-#ifdef WIN32
+#ifdef MSWIN
# include <shlobj.h>
/// When "fname" is the name of a shortcut (*.lnk) resolve the file it points
diff --git a/src/nvim/os/os_defs.h b/src/nvim/os/os_defs.h
index a4361859ec..a30e16eeba 100644
--- a/src/nvim/os/os_defs.h
+++ b/src/nvim/os/os_defs.h
@@ -7,7 +7,7 @@
#include <sys/stat.h>
#include <sys/types.h>
-#ifdef WIN32
+#ifdef MSWIN
# include "nvim/os/win_defs.h"
#else
# include "nvim/os/unix_defs.h"
@@ -43,7 +43,7 @@
/// Converts system error code to libuv error code.
#define os_translate_sys_error uv_translate_sys_error
-#ifdef WIN32
+#ifdef MSWIN
# define os_strtok strtok_s
#else
# define os_strtok strtok_r
diff --git a/src/nvim/os/process.c b/src/nvim/os/process.c
index e70bc71961..28aea08595 100644
--- a/src/nvim/os/process.c
+++ b/src/nvim/os/process.c
@@ -8,7 +8,7 @@
#include <uv.h> // for HANDLE (win32)
-#ifdef WIN32
+#ifdef MSWIN
# include <tlhelp32.h> // for CreateToolhelp32Snapshot
#endif
@@ -38,7 +38,7 @@
# include "os/process.c.generated.h"
#endif
-#ifdef WIN32
+#ifdef MSWIN
static bool os_proc_tree_kill_rec(HANDLE process, int sig)
{
if (process == NULL) {
@@ -114,7 +114,7 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count)
*proc_list = NULL;
*proc_count = 0;
-#ifdef WIN32
+#ifdef MSWIN
PROCESSENTRY32 pe;
// Snapshot of all processes.
@@ -215,7 +215,7 @@ int os_proc_children(int ppid, int **proc_list, size_t *proc_count)
return 0;
}
-#ifdef WIN32
+#ifdef MSWIN
/// Gets various properties of the process identified by `pid`.
///
/// @param pid Process to inspect.
diff --git a/src/nvim/os/pty_process.h b/src/nvim/os/pty_process.h
index 94923499ca..07d346be22 100644
--- a/src/nvim/os/pty_process.h
+++ b/src/nvim/os/pty_process.h
@@ -1,7 +1,7 @@
#ifndef NVIM_OS_PTY_PROCESS_H
#define NVIM_OS_PTY_PROCESS_H
-#ifdef WIN32
+#ifdef MSWIN
# include "nvim/os/pty_process_win.h"
#else
# include "nvim/os/pty_process_unix.h"
diff --git a/src/nvim/os/signal.c b/src/nvim/os/signal.c
index e592570966..9aa8d8051b 100644
--- a/src/nvim/os/signal.c
+++ b/src/nvim/os/signal.c
@@ -4,7 +4,7 @@
#include <assert.h>
#include <stdbool.h>
#include <uv.h>
-#ifndef WIN32
+#ifndef MSWIN
# include <signal.h> // for sigset_t
#endif
@@ -34,7 +34,7 @@ static bool rejecting_deadly;
void signal_init(void)
{
-#ifndef WIN32
+#ifndef MSWIN
// Ensure a clean slate by unblocking all signals. For example, if SIGCHLD is
// blocked, libuv may hang after spawning a subprocess on Linux. #5230
sigset_t mask;
diff --git a/src/nvim/os/stdpaths.c b/src/nvim/os/stdpaths.c
index 59d315d44c..31d85ac2eb 100644
--- a/src/nvim/os/stdpaths.c
+++ b/src/nvim/os/stdpaths.c
@@ -21,7 +21,7 @@ static const char *xdg_env_vars[] = {
[kXDGDataDirs] = "XDG_DATA_DIRS",
};
-#ifdef WIN32
+#ifdef MSWIN
static const char *const xdg_defaults_env_vars[] = {
[kXDGConfigHome] = "LOCALAPPDATA",
[kXDGDataHome] = "LOCALAPPDATA",
@@ -37,7 +37,7 @@ static const char *const xdg_defaults_env_vars[] = {
///
/// Used in case environment variables contain nothing. Need to be expanded.
static const char *const xdg_defaults[] = {
-#ifdef WIN32
+#ifdef MSWIN
[kXDGConfigHome] = "~\\AppData\\Local",
[kXDGDataHome] = "~\\AppData\\Local",
[kXDGCacheHome] = "~\\AppData\\Local\\Temp",
@@ -69,7 +69,7 @@ char *stdpaths_get_xdg_var(const XDGVarType idx)
const char *env_val = os_getenv(env);
-#ifdef WIN32
+#ifdef MSWIN
if (env_val == NULL && xdg_defaults_env_vars[idx] != NULL) {
env_val = os_getenv(xdg_defaults_env_vars[idx]);
}
@@ -107,7 +107,7 @@ char *get_xdg_home(const XDGVarType idx)
{
char *dir = stdpaths_get_xdg_var(idx);
if (dir) {
-#if defined(WIN32)
+#if defined(MSWIN)
dir = concat_fnames_realloc(dir,
((idx == kXDGDataHome
|| idx == kXDGStateHome) ? "nvim-data" : "nvim"),
diff --git a/src/nvim/os/tty.c b/src/nvim/os/tty.c
index 126b1b0044..1b15613a93 100644
--- a/src/nvim/os/tty.c
+++ b/src/nvim/os/tty.c
@@ -12,7 +12,7 @@
# include "os/tty.c.generated.h"
#endif
-#ifdef WIN32
+#ifdef MSWIN
# if !defined(ENABLE_VIRTUAL_TERMINAL_PROCESSING)
# define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
# endif
diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c
index 7b0f3ddaed..33e6563c4c 100644
--- a/src/nvim/os/users.c
+++ b/src/nvim/os/users.c
@@ -14,7 +14,7 @@
#ifdef HAVE_PWD_H
# include <pwd.h>
#endif
-#ifdef WIN32
+#ifdef MSWIN
# include <lm.h>
#endif
@@ -56,7 +56,7 @@ int os_get_usernames(garray_T *users)
}
endpwent();
}
-#elif defined(WIN32)
+#elif defined(MSWIN)
{
DWORD nusers = 0, ntotal = 0, i;
PUSER_INFO_0 uinfo;
diff --git a/src/nvim/os/win_defs.h b/src/nvim/os/win_defs.h
index 1ae86d6bbe..4f8a242a51 100644
--- a/src/nvim/os/win_defs.h
+++ b/src/nvim/os/win_defs.h
@@ -1,7 +1,7 @@
#ifndef NVIM_OS_WIN_DEFS_H
#define NVIM_OS_WIN_DEFS_H
-#ifndef WIN32
+#ifndef MSWIN
# error Header must be included only when compiling for Windows.
#endif