ladybird/Userland/id.cpp
Andreas Kling 9886b27d9c Add getpwent() family of functions to LibC.
Also add a little /etc/passwd database. There's just me in there.
2018-10-31 19:54:25 +01:00

16 lines
282 B
C++

#include <LibC/unistd.h>
#include <LibC/stdio.h>
#include <LibC/pwd.h>
int main(int c, char** v)
{
uid_t uid = getuid();
gid_t gid = getgid();
struct passwd* pw = getpwuid(uid);
printf("uid=%u(%s), gid=%u\n", uid, pw ? pw->pw_name : "n/a", gid);
return 0;
}