source: tools/getfreespace/getfreespace.c @ 2590

Last change on this file since 2590 was 2590, checked in by nit, 14 years ago

add getfreespace tool to get free space from a path (getfreespace /var/swap)

File size: 326 bytes
Line 
1#include <sys/vfs.h>
2
3main(argc,argv)
4int argc;
5char *argv[];
6{
7        if (argc == 2)
8        {
9                struct statfs s;
10                int tmp;
11                if (statfs(argv[1], &s)<0)
12                        tmp=0;
13                else
14                {
15                        tmp=s.f_bfree;
16                        tmp*=s.f_bsize;
17                }
18
19                printf("%d\n", tmp);
20        }
21        else
22                printf("0\n");
23}
Note: See TracBrowser for help on using the repository browser.