aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/os/users.c
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-29 21:52:58 +0000
commit931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch)
treed8c1843a95da5ea0bb4acc09f7e37843d9995c86 /src/nvim/os/users.c
parent142d9041391780ac15b89886a54015fdc5c73995 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.gz
rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.tar.bz2
rneovim-931bffbda3668ddc609fc1da8f9eb576b170aa52.zip
Merge remote-tracking branch 'upstream/master' into userreguserreg
Diffstat (limited to 'src/nvim/os/users.c')
-rw-r--r--src/nvim/os/users.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/nvim/os/users.c b/src/nvim/os/users.c
index ef2986246b..ae0994a73f 100644
--- a/src/nvim/os/users.c
+++ b/src/nvim/os/users.c
@@ -1,6 +1,3 @@
-// This is an open source non-commercial project. Dear PVS-Studio, please check
-// it. PVS-Studio Static Code Analyzer for C, C++ and C#: http://www.viva64.com
-
// users.c -- operating system user information
#include <stdbool.h>
@@ -9,17 +6,20 @@
#include <uv.h>
#include "auto/config.h"
-#include "nvim/ascii.h"
+#include "nvim/ascii_defs.h"
+#include "nvim/cmdexpand_defs.h"
#include "nvim/garray.h"
#include "nvim/memory.h"
#include "nvim/os/os.h"
-#include "nvim/types.h"
-#include "nvim/vim.h"
-#ifdef HAVE_PWD_H
+#include "nvim/vim_defs.h"
+#ifdef HAVE_PWD_FUNCS
# include <pwd.h>
#endif
#ifdef MSWIN
# include <lm.h>
+
+# include "nvim/mbyte.h"
+# include "nvim/message.h"
#endif
// All user names (for ~user completion as done by shell).
@@ -30,7 +30,7 @@ static garray_T ga_users = GA_EMPTY_INIT_VALUE;
static void add_user(garray_T *users, char *user, bool need_copy)
{
char *user_copy = (user != NULL && need_copy)
- ? xstrdup(user) : user;
+ ? xstrdup(user) : user;
if (user_copy == NULL || *user_copy == NUL) {
if (need_copy) {
@@ -50,7 +50,7 @@ int os_get_usernames(garray_T *users)
}
ga_init(users, sizeof(char *), 20);
-#if defined(HAVE_GETPWENT) && defined(HAVE_PWD_H)
+#ifdef HAVE_PWD_FUNCS
{
struct passwd *pw;
@@ -81,7 +81,7 @@ int os_get_usernames(garray_T *users)
}
}
#endif
-#if defined(HAVE_GETPWNAM)
+#ifdef HAVE_PWD_FUNCS
{
const char *user_env = os_getenv("USER");
@@ -141,7 +141,7 @@ int os_get_username(char *s, size_t len)
/// @return OK if a username was found, else FAIL.
int os_get_uname(uv_uid_t uid, char *s, size_t len)
{
-#if defined(HAVE_PWD_H) && defined(HAVE_GETPWUID)
+#ifdef HAVE_PWD_FUNCS
struct passwd *pw;
if ((pw = getpwuid(uid)) != NULL // NOLINT(runtime/threadsafe_fn)
@@ -159,7 +159,7 @@ int os_get_uname(uv_uid_t uid, char *s, size_t len)
/// Caller must free() the returned string.
char *os_get_userdir(const char *name)
{
-#if defined(HAVE_GETPWNAM) && defined(HAVE_PWD_H)
+#ifdef HAVE_PWD_FUNCS
if (name == NULL || *name == NUL) {
return NULL;
}