patch 8.1.2084: Amiga: cannot get the user name
Problem: Amiga: cannot get the user name.
Solution: Use getpwuid() if available. (Ola Söder, closes #4985)
diff --git a/src/os_amiga.c b/src/os_amiga.c
index dfc8053..aff24c5 100644
--- a/src/os_amiga.c
+++ b/src/os_amiga.c
@@ -664,7 +664,15 @@
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;
}