From 5e8e967f25085de78d7826fe5a6bebbace1c6823 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 27 Sep 2019 13:38:56 +0200 Subject: patch 8.1.2084: Amiga: cannot get the user name MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Problem: Amiga: cannot get the user name. Solution: Use getpwuid() if available. (Ola Söder, closes #4985) --- src/os_amiga.c | 10 +++++++++- src/os_amiga.h | 1 + src/version.c | 2 ++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/os_amiga.c b/src/os_amiga.c index dfc805374..aff24c567 100644 --- a/src/os_amiga.c +++ b/src/os_amiga.c @@ -664,7 +664,15 @@ mch_can_restore_icon(void) int mch_get_user_name(char_u *s, int len) { - /* TODO: Implement this. */ +#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__) + struct passwd *pwd = getpwuid(getuid()); + + if (pwd != NULL && pwd->pw_name && len > 0) + { + vim_strncpy(s, (char_u *)pwd->pw_name, len - 1); + return OK; + } +#endif *s = NUL; return FAIL; } diff --git a/src/os_amiga.h b/src/os_amiga.h index 6f951fb96..71841ac6a 100644 --- a/src/os_amiga.h +++ b/src/os_amiga.h @@ -90,6 +90,7 @@ typedef long off_t; # include # include # include +# include # include #endif diff --git a/src/version.c b/src/version.c index 98ddcca84..6c17851ec 100644 --- a/src/version.c +++ b/src/version.c @@ -757,6 +757,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 2084, /**/ 2083, /**/ -- cgit v1.2.1