2005-03-30 02:39:22 +00:00
# include <stdio.h>
# include <unistd.h>
# include <string.h>
# include <time.h>
# include <libsmbclient.h>
2005-03-31 05:06:04 +00:00
# include "get_auth_data_fn.h"
2005-03-30 02:39:22 +00:00
int main ( int argc , char * argv [ ] )
{
2005-03-31 21:17:36 +00:00
int debug = 0 ;
2005-03-30 02:39:22 +00:00
char buffer [ 16384 ] ;
2005-03-31 16:26:15 +00:00
char mtime [ 32 ] ;
char ctime [ 32 ] ;
char atime [ 32 ] ;
2005-03-30 02:39:22 +00:00
char * pSmbPath = NULL ;
char * pLocalPath = NULL ;
struct stat st ;
if ( argc = = 1 )
{
pSmbPath = " smb://RANDOM/Public/small " ;
pLocalPath = " /random/home/samba/small " ;
}
else if ( argc = = 2 )
{
pSmbPath = argv [ 1 ] ;
pLocalPath = NULL ;
}
else if ( argc = = 3 )
{
pSmbPath = argv [ 1 ] ;
pLocalPath = argv [ 2 ] ;
}
else
{
printf ( " usage: "
" %s [ smb://path/to/file [ /nfs/or/local/path/to/file ] ] \n " ,
argv [ 0 ] ) ;
return 1 ;
}
2005-03-31 21:17:36 +00:00
smbc_init ( get_auth_data_fn , debug ) ;
2005-03-30 02:39:22 +00:00
2005-03-31 16:26:15 +00:00
if ( smbc_stat ( pSmbPath , & st ) < 0 )
{
perror ( " smbc_stat " ) ;
return 1 ;
}
2005-03-30 02:39:22 +00:00
2005-12-25 02:00:35 +00:00
printf ( " \n SAMBA \n mtime:%lu/%s ctime:%lu/%s atime:%lu/%s \n " ,
2005-03-31 16:26:15 +00:00
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 ) ) ;
2005-03-30 02:39:22 +00:00
if ( pLocalPath ! = NULL )
{
2005-03-31 16:26:15 +00:00
if ( stat ( pLocalPath , & st ) < 0 )
{
perror ( " stat " ) ;
return 1 ;
}
2005-03-30 02:39:22 +00:00
2005-03-31 16:26:15 +00:00
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 ) ) ;
2005-03-30 02:39:22 +00:00
}
return 0 ;
}