summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-09-27 13:38:56 +0200
committerBram Moolenaar <Bram@vim.org>2019-09-27 13:38:56 +0200
commit5e8e967f25085de78d7826fe5a6bebbace1c6823 (patch)
tree20c1041e70966d934981decec3972b0383a703db
parentce0fac28977af31f1dec411d3535b4de2c3169b3 (diff)
patch 8.1.2084: Amiga: cannot get the user namev8.1.2084
Problem: Amiga: cannot get the user name. Solution: Use getpwuid() if available. (Ola Söder, closes #4985)
-rw-r--r--src/os_amiga.c10
-rw-r--r--src/os_amiga.h1
-rw-r--r--src/version.c2
3 files changed, 12 insertions, 1 deletions
diff --git a/src/os_amiga.c b/src/os_amiga.c
index dfc805374f..aff24c5674 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 6f951fb96b..71841ac6a5 100644
--- a/src/os_amiga.h
+++ b/src/os_amiga.h
@@ -90,6 +90,7 @@ typedef long off_t;
# include <unistd.h>
# include <limits.h>
# include <errno.h>
+# include <pwd.h>
# include <dirent.h>
#endif
diff --git a/src/version.c b/src/version.c
index 98ddcca846..6c17851ece 100644
--- a/src/version.c
+++ b/src/version.c
@@ -758,6 +758,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 2084,
+/**/
2083,
/**/
2082,