Used stat, utime and utimbuf instead of _stat, _utime and _utimbuf.

svn path=/trunk/; revision=12256
This commit is contained in:
Hartmut Birr 2004-12-20 19:55:26 +00:00
parent 7f6d0de950
commit 22b8e65551

View file

@ -2,10 +2,10 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/utime.h>
#ifdef WIN32 #ifdef WIN32
#include <io.h> #include <io.h>
#include <dos.h> #include <dos.h>
#include <utime.h>
#else #else
#include <sys/io.h> #include <sys/io.h>
#include <errno.h> #include <errno.h>
@ -86,8 +86,8 @@ copy_file(char* path1, char* path2)
char* buf; char* buf;
int n_in; int n_in;
int n_out; int n_out;
struct _stat st_buffer; struct stat st_buffer;
struct _utimbuf ut_buffer; struct utimbuf ut_buffer;
in = fopen(path1, "rb"); in = fopen(path1, "rb");
if (in == NULL) if (in == NULL)
@ -122,14 +122,14 @@ copy_file(char* path1, char* path2)
fclose(in); fclose(in);
fclose(out); fclose(out);
if (_stat(path2, &st_buffer) >= 0) if (stat(path2, &st_buffer) >= 0)
{ {
ut_buffer.actime = st_buffer.st_atime; ut_buffer.actime = st_buffer.st_atime;
if (_stat(path1, &st_buffer) >= 0) if (stat(path1, &st_buffer) >= 0)
{ {
ut_buffer.modtime = st_buffer.st_mtime; ut_buffer.modtime = st_buffer.st_mtime;
_utime(path2, &ut_buffer); utime(path2, &ut_buffer);
} }
} }