Mercurial > vim
comparison src/os_amiga.c @ 18178:a3ddd35ee6d4 v8.1.2084
patch 8.1.2084: Amiga: cannot get the user name
Commit: https://github.com/vim/vim/commit/5e8e967f25085de78d7826fe5a6bebbace1c6823
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Sep 27 13:38:56 2019 +0200
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 https://github.com/vim/vim/issues/4985)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Fri, 27 Sep 2019 13:45:05 +0200 |
parents | 723ec38d521e |
children | 7f16792d15f7 |
comparison
equal
deleted
inserted
replaced
18177:a98f052160ff | 18178:a3ddd35ee6d4 |
---|---|
662 * Insert user name in s[len]. | 662 * Insert user name in s[len]. |
663 */ | 663 */ |
664 int | 664 int |
665 mch_get_user_name(char_u *s, int len) | 665 mch_get_user_name(char_u *s, int len) |
666 { | 666 { |
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 | |
668 *s = NUL; | 676 *s = NUL; |
669 return FAIL; | 677 return FAIL; |
670 } | 678 } |
671 | 679 |
672 /* | 680 /* |