ChangeLog: 19990626-13:35

This commit is contained in:
Ryszard Glab
1999-06-26 12:49:11 +00:00
parent 30dbdd616a
commit 5ad45e8a2e
3 changed files with 29 additions and 0 deletions

View File

@@ -1,3 +1,11 @@
19990626-13:35 Ryszard Glab <rglab@imid.med.pl>
* source/rtl/copyfile.c
* added code to copy also the file permissions on *nix
* source/rtl/files.c
* 'access' function should use F_OK constant instead of 0 on *nix
19990626-13:12 Ryszard Glab <rglab@imid.med.pl>
* tests/working/Makefile

View File

@@ -8,6 +8,11 @@
#include <ctoharb.h>
#include <filesys.h>
#ifdef OS_UNIX_COMPATIBLE
#include <sys/stat.h>
#include <unistd.h>
#endif
#define BUFFER_SIZE 8192
static long hb_fsCopy(BYTEP ,BYTEP ) ;
@@ -36,6 +41,10 @@ static long hb_fsCopy(BYTEP source,BYTEP dest)
USHORT usCount;
ULONG ulCount = 0L;
PHB_ITEM pError;
#ifdef OS_UNIX_COMPATIBLE
struct stat struFileInfo;
int iSuccess;
#endif
sHANDLE = hb_fsOpen(source, FO_READ);
if ( hb_fsError() )
{
@@ -45,6 +54,9 @@ static long hb_fsCopy(BYTEP source,BYTEP dest)
hb_errRelease(pError);
return( -1L) ;
}
#ifdef OS_UNIX_COMPATIBLE
iSuccess =fstat( sHANDLE, &struFileInfo );
#endif
dHANDLE = hb_fsCreate(dest,FC_NORMAL);
if ( hb_fsError() )
{
@@ -71,6 +83,10 @@ static long hb_fsCopy(BYTEP source,BYTEP dest)
hb_fsWrite(dHANDLE,buffer,usCount);
hb_xfree(buffer);
hb_fsClose(sHANDLE);
#ifdef OS_UNIX_COMPATIBLE
if( iSuccess == 0 )
fchmod( dHANDLE, struFileInfo.st_mode );
#endif
hb_fsClose(dHANDLE);
return( ulCount );
}

View File

@@ -659,7 +659,12 @@ HARBOUR HB_FILE( void )
if( arg1_it )
{
/*TODO: Check if F_OK is defined in all compilers */
#ifdef OS_UNIX_COMPATIBLE
hb_retl( access(hb_parc(1), F_OK) == 0 );
#else
hb_retl( access(hb_parc(1), 0) == 0 );
#endif
}
else hb_retl(0);
return;