diff --git a/apps/src/stat.c b/apps/src/stat.c index d07035d1..b78e6eff 100644 --- a/apps/src/stat.c +++ b/apps/src/stat.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -45,11 +46,16 @@ int main(int argc, char** argv) default: puts("Unknown"); break; } + struct passwd* own = getpwuid(st.st_uid); + printf("Length: %ld\n", st.st_size); printf("Inode: %ld\n", st.st_ino); - printf("UID: %d\n", st.st_uid); - printf("GID: %d\n", st.st_gid); + if (!own) printf("Owned by: UID %d\n", st.st_uid); + else + printf("Owned by: %s\n", own->pw_name); printf("Mode: %s\n", mode_to_string(st.st_mode)); + endpwent(); + return EXIT_SUCCESS; } \ No newline at end of file