mirror of
https://github.com/9fans/plan9port.git
synced 2025-01-15 11:20:03 +00:00
18 lines
239 B
C
18 lines
239 B
C
|
#include <pwd.h>
|
||
|
|
||
|
#include <u.h>
|
||
|
#include <libc.h>
|
||
|
|
||
|
char*
|
||
|
getuser(void)
|
||
|
{
|
||
|
static char user[64];
|
||
|
struct passwd *pw;
|
||
|
|
||
|
pw = getpwuid(getuid());
|
||
|
if(pw == nil)
|
||
|
return "none";
|
||
|
strecpy(user, user+sizeof user, pw->pw_name);
|
||
|
return user;
|
||
|
}
|