plan9port/src/lib9/getuser.c
rsc 8ad517944e Today's changes.
More changes.
2004-03-25 23:03:57 +00:00

16 lines
238 B
C

#include <u.h>
#include <pwd.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;
}