shithub: drawcpu

ref: a25a94e8f04e1d852c4ac2e8924f243e2fb70cbb
dir: /getuser.c/

View raw version
#include <u.h>
#include <pwd.h>
#include <libc.h>
#include "drawcpu.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;
}