From 8e6b4b9867b7507c8a1542a5b3389a08ffba722b Mon Sep 17 00:00:00 2001 From: Derrell Lipman Date: Thu, 31 Mar 2005 16:26:15 +0000 Subject: r6151: additional examples/tests for libsmbclient (This used to be commit a3bd496c921dc775b59be4ff2941f4824ffbec03) --- examples/libsmbclient/teststat.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) (limited to 'examples/libsmbclient/teststat.c') 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; -- cgit