tgetuser.c - plan9port - [fork] Plan 9 from user space
HTML git clone git://src.adamsgaard.dk/plan9port
DIR Log
DIR Files
DIR Refs
DIR README
DIR LICENSE
---
tgetuser.c (238B)
---
1 #include <u.h>
2 #include <pwd.h>
3 #include <libc.h>
4
5 char*
6 getuser(void)
7 {
8 static char user[64];
9 struct passwd *pw;
10
11 pw = getpwuid(getuid());
12 if(pw == nil)
13 return "none";
14 strecpy(user, user+sizeof user, pw->pw_name);
15 return user;
16 }