diff options
author | Andreas Kling <awesomekling@gmail.com> | 2018-11-06 22:27:51 +0100 |
---|---|---|
committer | Andreas Kling <awesomekling@gmail.com> | 2018-11-06 22:27:51 +0100 |
commit | 90bab5ea717682d819609e9238ab6785a450b696 (patch) | |
tree | 3351641a076ff2de7baeee33d1fc2ed4110bae24 /Userland | |
parent | e5e0bffd769ed29c42dc07e70dc40639b6ba51c7 (diff) | |
download | serenity-90bab5ea717682d819609e9238ab6785a450b696.zip |
Add getgrent() family of functions.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/id.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/id.cpp b/Userland/id.cpp index 44a31264fc..e82cfcf2c4 100644 --- a/Userland/id.cpp +++ b/Userland/id.cpp @@ -1,6 +1,7 @@ #include <LibC/unistd.h> #include <LibC/stdio.h> #include <LibC/pwd.h> +#include <LibC/grp.h> int main(int c, char** v) { @@ -8,8 +9,9 @@ int main(int c, char** v) gid_t gid = getgid(); struct passwd* pw = getpwuid(uid); + struct group* gr = getgrgid(gid); - printf("uid=%u(%s), gid=%u, pid=%u\n", uid, pw ? pw->pw_name : "n/a", gid, getpid()); + printf("uid=%u(%s), gid=%u(%s)\n", uid, pw ? pw->pw_name : "n/a", gid, gr ? gr->gr_name : "n/a", getpid()); return 0; } |