Advertisement
Guest User

Untitled

a guest
Apr 29th, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <sys/stat.h>
  2. #include <stdio.h>
  3.  
  4. int main(int argc, char **argv) {
  5. if (argc != 2) {
  6. fprintf(stderr, "error: must specify (only) one file\n");
  7. return -1;
  8. }
  9.  
  10. struct stat attr;
  11.  
  12. if (stat(argv[1], &attr)) {
  13. perror("could not stat file");
  14. return -2;
  15. }
  16.  
  17. #define S(delim, name) printf(#name ":\x1b[30G%" #delim "\n", attr.st_##name);
  18. S(ud, dev);
  19. S(llud, ino);
  20. S(oo, mode);
  21. S(dd, nlink);
  22. S(dd, uid);
  23. S(dd, gid);
  24. S(ud, rdev);
  25. S(llud, size);
  26. S(llud, blocks);
  27. S(dd, blksize);
  28. S(ud, flags);
  29. S(ud, gen);
  30.  
  31. return 0;
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement