rpc_server: Avoid casts in DBG statements
[Samba.git] / examples / libsmbclient / teststat.c
blob4084fd08e61fcf84ac7c35b3ba0835725a0ebb58
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:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
51 (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
52 (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
53 (long long)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:%lld/%s ctime:%lld/%s atime:%lld/%s\n",
64 (long long)st.st_mtime, ctime_r(&st.st_mtime, m_time),
65 (long long)st.st_ctime, ctime_r(&st.st_ctime, c_time),
66 (long long)st.st_atime, ctime_r(&st.st_atime, a_time));
69 return 0;