Advertisement
anechka_ne_plach

Untitled

Feb 21st, 2022
198
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.58 KB | None | 0 0
  1.  #include <stdio.h>
  2.    2   │ #include <sys/stat.h>
  3.    3   │ #include <stdint.h>
  4.    4   │
  5.    5   │
  6.    6   │ int main(int argc, char** argv) {
  7.    7   │     struct stat info;
  8.    8   │     int64_t ans = 0;
  9.    9   │     for (int i = 1; i < argc; ++i) {
  10.   10   │         if (lstat(argv[i], &info) == -1) {
  11.   11   │             continue;
  12.   12   │         }
  13.   13   │         if (S_ISLNK(info.st_mode) == 0 && info.st_nlink == 1) {
  14.   14   │             ans += info.st_size;
  15.   15   │         }
  16.   16   │     }
  17.   17   │     printf("%lld\n", ans);
  18.   18   │ }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement