ladybird/Userland/id.cpp

16 lines
300 B
C++
Raw Normal View History

2018-10-22 14:06:22 +02:00
#include <LibC/unistd.h>
#include <LibC/stdio.h>
#include <LibC/pwd.h>
2018-10-22 14:06:22 +02:00
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, pid=%u\n", uid, pw ? pw->pw_name : "n/a", gid, getpid());
2018-10-22 14:06:22 +02:00
return 0;
}