stat.c (467B)
1 #include <stdio.h> 2 #include <sys/stat.h> 3 4 int main(int argc __attribute__((unused)), char *argv[]) 5 { 6 struct stat st; 7 8 if (stat(argv[0], &st) == -1) 9 { 10 fprintf(stderr, "stat failed\n"); 11 return 1; 12 } 13 #if defined(__linux__) 14 printf("stat %s: ino: %lu uid: %d gid: %d\n", argv[0], st.st_ino, st.st_uid, st.st_gid); 15 #else 16 printf("stat %s: ino: %llu uid: %d gid: %d\n", argv[0], st.st_ino, st.st_uid, st.st_gid); 17 #endif 18 return 0; 19 }