summaryrefslogtreecommitdiff
path: root/examples/libsmbclient/teststat.c
diff options
context:
space:
mode:
authorDerrell Lipman <derrell@samba.org>2005-03-31 16:26:15 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 10:56:25 -0500
commit8e6b4b9867b7507c8a1542a5b3389a08ffba722b (patch)
tree520dc470239ca45f8180dfd56ba9d8c2455e5a74 /examples/libsmbclient/teststat.c
parent9840db418bad5a39edc4a32a1786f5e2d2c9dff8 (diff)
downloadsamba-8e6b4b9867b7507c8a1542a5b3389a08ffba722b.tar.gz
samba-8e6b4b9867b7507c8a1542a5b3389a08ffba722b.tar.bz2
samba-8e6b4b9867b7507c8a1542a5b3389a08ffba722b.zip
r6151: additional examples/tests for libsmbclient
(This used to be commit a3bd496c921dc775b59be4ff2941f4824ffbec03)
Diffstat (limited to 'examples/libsmbclient/teststat.c')
-rw-r--r--examples/libsmbclient/teststat.c31
1 files changed, 21 insertions, 10 deletions
diff --git a/examples/libsmbclient/teststat.c b/examples/libsmbclient/teststat.c
index bea34cfc09..d67f626d78 100644
--- a/examples/libsmbclient/teststat.c
+++ b/examples/libsmbclient/teststat.c
@@ -9,6 +9,9 @@
int main(int argc, char * argv[])
{
char buffer[16384];
+ char mtime[32];
+ char ctime[32];
+ char atime[32];
char * pSmbPath = NULL;
char * pLocalPath = NULL;
struct stat st;
@@ -38,21 +41,29 @@ int main(int argc, char * argv[])
smbc_init(get_auth_data_fn, 0);
- int ret = smbc_stat(pSmbPath, &st);
+ if (smbc_stat(pSmbPath, &st) < 0)
+ {
+ perror("smbc_stat");
+ return 1;
+ }
- printf("SAMBA\nret=%d,\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n", ret,
- st.st_mtime, ctime(&st.st_mtime),
- st.st_ctime, ctime(&st.st_ctime),
- st.st_atime, ctime(&st.st_atime));
+ printf("SAMBA\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
+ st.st_mtime, ctime_r(&st.st_mtime, mtime),
+ st.st_ctime, ctime_r(&st.st_ctime, ctime),
+ st.st_atime, ctime_r(&st.st_atime, atime));
if (pLocalPath != NULL)
{
- ret = stat(pLocalPath, &st);
+ if (stat(pLocalPath, &st) < 0)
+ {
+ perror("stat");
+ return 1;
+ }
- printf("LOCAL\nret=%d,\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n", ret,
- st.st_mtime, ctime(&st.st_mtime),
- st.st_ctime, ctime(&st.st_ctime),
- st.st_atime, ctime(&st.st_atime));
+ printf("LOCAL\n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s\n",
+ st.st_mtime, ctime_r(&st.st_mtime, mtime),
+ st.st_ctime, ctime_r(&st.st_ctime, ctime),
+ st.st_atime, ctime_r(&st.st_atime, atime));
}
return 0;