1
0
forked from aniani/vim

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)
This commit is contained in:
Bram Moolenaar
2019-09-27 13:38:56 +02:00
parent ce0fac2897
commit 5e8e967f25
3 changed files with 12 additions and 1 deletions

View File

@@ -664,7 +664,15 @@ mch_can_restore_icon(void)
int int
mch_get_user_name(char_u *s, int len) 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; *s = NUL;
return FAIL; return FAIL;
} }

View File

@@ -90,6 +90,7 @@ typedef long off_t;
# include <unistd.h> # include <unistd.h>
# include <limits.h> # include <limits.h>
# include <errno.h> # include <errno.h>
# include <pwd.h>
# include <dirent.h> # include <dirent.h>
#endif #endif

View File

@@ -757,6 +757,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
2084,
/**/ /**/
2083, 2083,
/**/ /**/