Skip to content

Commit 5e8e967

Browse files
committed
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)
1 parent ce0fac2 commit 5e8e967

3 files changed

Lines changed: 12 additions & 1 deletion

File tree

src/os_amiga.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -664,7 +664,15 @@ mch_can_restore_icon(void)
664664
int
665665
mch_get_user_name(char_u *s, int len)
666666
{
667-
/* TODO: Implement this. */
667+
#if defined(__amigaos4__) || defined(__AROS__) || defined(__MORPHOS__)
668+
struct passwd *pwd = getpwuid(getuid());
669+
670+
if (pwd != NULL && pwd->pw_name && len > 0)
671+
{
672+
vim_strncpy(s, (char_u *)pwd->pw_name, len - 1);
673+
return OK;
674+
}
675+
#endif
668676
*s = NUL;
669677
return FAIL;
670678
}

src/os_amiga.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ typedef long off_t;
9090
# include <unistd.h>
9191
# include <limits.h>
9292
# include <errno.h>
93+
# include <pwd.h>
9394
# include <dirent.h>
9495
#endif
9596

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,8 @@ static char *(features[]) =
757757

758758
static int included_patches[] =
759759
{ /* Add new patch number below this line */
760+
/**/
761+
2084,
760762
/**/
761763
2083,
762764
/**/

0 commit comments

Comments
 (0)