Created
April 24, 2015 20:40
-
-
Save mirekfranc/39e68b8657fad7d41894 to your computer and use it in GitHub Desktop.
Report file sizes :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/stat.h> | |
#include <stdio.h> | |
int | |
main (int argc, char *argv[]) | |
{ | |
struct stat t; | |
while (*++argv != NULL) | |
{ | |
if (lstat (*argv, &t) == -1) | |
perror ("stat"); | |
if (! S_ISREG (t.st_mode) && ! S_ISLNK (t.st_mode)) | |
continue; | |
printf ("%s has %ld bytes\n", *argv, (long) t.st_size); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment