#include #include #include #include #include #define MAX_BUFF_SIZE 255 char g_workgroup[MAX_BUFF_SIZE]; char g_username[MAX_BUFF_SIZE]; char g_password[MAX_BUFF_SIZE]; void auth_fn(const char* server, const char* share, char* workgroup, int wgmaxlen, char* username, int unmaxlen, char* password, int pwmaxlen) { strncpy(workgroup, g_workgroup, wgmaxlen - 1); strncpy(username, "admin", 6); strncpy(password, "admin", 6); } int gettime(const char* _pszFilename) { //char *pSmbPath = 0; struct stat st; char mtime[32]; char ctime[32]; char atime[32]; smbc_init(auth_fn, 0); if (smbc_stat(_pszFilename, &st) < 0) { perror("smbc_stat"); return 1; } 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)); // check the stat on this file if (stat("staterror.c", &st) < 0) { perror("stat"); return 1; } 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; } int main(int argc, char* argv[]) { if( 1 == argc ) printf("usage: %s smb://\n", argv[0]); else gettime(argv[1]); return 0; }