idl: add to_null property
[Samba/gbeck.git] / examples / libsmbclient / teststatvfs.c
blob5c69122afce4e28bbb76a9ce63bce32b85064241
1 #include <sys/types.h>
2 #include <sys/statvfs.h>
3 #include <stdio.h>
4 #include <unistd.h>
5 #include <string.h>
6 #include <time.h>
7 #include <errno.h>
8 #include <libsmbclient.h>
9 #include "get_auth_data_fn.h"
12 int main(int argc, char * argv[])
14 int ret;
15 int debug = 0;
16 char * p;
17 char path[2048];
18 struct statvfs statvfsbuf;
20 smbc_init(get_auth_data_fn, debug);
22 for (;;)
24 fprintf(stdout, "Path: ");
25 *path = '\0';
26 fgets(path, sizeof(path) - 1, stdin);
27 if (strlen(path) == 0)
29 return 0;
32 p = path + strlen(path) - 1;
33 if (*p == '\n')
35 *p = '\0';
38 ret = smbc_statvfs(path, &statvfsbuf);
40 if (ret < 0)
42 perror("fstatvfs");
44 else
46 printf("\n");
47 printf("Block Size: %lu\n", statvfsbuf.f_bsize);
48 printf("Fragment Size: %lu\n", statvfsbuf.f_frsize);
49 printf("Blocks: %llu\n",
50 (unsigned long long) statvfsbuf.f_blocks);
51 printf("Free Blocks: %llu\n",
52 (unsigned long long) statvfsbuf.f_bfree);
53 printf("Available Blocks: %llu\n",
54 (unsigned long long) statvfsbuf.f_bavail);
55 printf("Files : %llu\n",
56 (unsigned long long) statvfsbuf.f_files);
57 printf("Free Files: %llu\n",
58 (unsigned long long) statvfsbuf.f_ffree);
59 printf("Available Files: %llu\n",
60 (unsigned long long) statvfsbuf.f_favail);
61 printf("File System ID: %lu\n",
62 (unsigned long) statvfsbuf.f_fsid);
63 printf("\n");
65 printf("Flags: 0x%lx\n", statvfsbuf.f_flag);
66 printf("Extended Features: ");
68 if (statvfsbuf.f_flag & SMBC_VFS_FEATURE_NO_UNIXCIFS)
70 printf("NO_UNIXCIFS ");
72 else
74 printf("unixcifs ");
77 if (statvfsbuf.f_flag & SMBC_VFS_FEATURE_CASE_INSENSITIVE)
79 printf("CASE_INSENSITIVE ");
81 else
83 printf("case_sensitive ");
86 if (statvfsbuf.f_flag & SMBC_VFS_FEATURE_DFS)
88 printf("DFS ");
90 else
92 printf("no_dfs ");
95 printf("\n");
99 return 0;