wafsamba: use additional xml catalog file (bug #9512)
[Samba/gbeck.git] / examples / libsmbclient / teststat.c
blobf36639eab7b382c2d7ac5e3a3c4d6ed0c80b3a69
1 #include <stdio.h>
2 #include <unistd.h>
3 #include <string.h>
4 #include <time.h>
5 #include <libsmbclient.h>
6 #include "get_auth_data_fn.h"
9 int main(int argc, char * argv[])
11 int debug = 0;
12 char m_time[32];
13 char c_time[32];
14 char a_time[32];
15 const char * pSmbPath = NULL;
16 const char * pLocalPath = NULL;
17 struct stat st;
19 if (argc == 1)
21 pSmbPath = "smb://RANDOM/Public/small";
22 pLocalPath = "/random/home/samba/small";
24 else if (argc == 2)
26 pSmbPath = argv[1];
27 pLocalPath = NULL;
29 else if (argc == 3)
31 pSmbPath = argv[1];
32 pLocalPath = argv[2];
34 else
36 printf("usage: "
37 "%s [ smb://path/to/file [ /nfs/or/local/path/to/file ] ]\n",
38 argv[0]);
39 return 1;
42 smbc_init(get_auth_data_fn, debug);
44 if (smbc_stat(pSmbPath, &st) < 0)
46 perror("smbc_stat");
47 return 1;
50 printf("\nSAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
51 st.st_mtime, ctime_r(&st.st_mtime, m_time),
52 st.st_ctime, ctime_r(&st.st_ctime, c_time),
53 st.st_atime, ctime_r(&st.st_atime, a_time));
55 if (pLocalPath != NULL)
57 if (stat(pLocalPath, &st) < 0)
59 perror("stat");
60 return 1;
63 printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
64 st.st_mtime, ctime_r(&st.st_mtime, m_time),
65 st.st_ctime, ctime_r(&st.st_ctime, c_time),
66 st.st_atime, ctime_r(&st.st_atime, a_time));
69 return 0;