home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
rtsi.com
/
2014.01.www.rtsi.com.tar
/
www.rtsi.com
/
OS9
/
OS9000
/
APPS
/
rcs.lzh
/
rcs1
/
utime.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-04-20
|
717b
|
41 lines
#include <modes.h>
#ifdef _OS9000
#include <rbf.h>
#define fildes fd_stats
#else
#include <direct.h>
#endif
#include "utime.h"
int utime( pathname, timep)
char *pathname;
struct utimbuf *timep;
{
int path,rc;
struct fildes dp;
struct tm *tp;
if( ( path = open( pathname, S_IREAD|S_IWRITE) ) < 0 ) return(-1);
if( _gs_gfd( path, &dp , sizeof(dp) ) < 0 )
{
close(path);
return(-1);
}
#ifdef _OS9000
dp.fd_utime = *(time_t *)timep;
#else
tp = localtime((time_t *)timep);
dp.fd_date[0] = tp->tm_year;
dp.fd_date[1] = tp->tm_mon+1;
dp.fd_date[2] = tp->tm_mday;
dp.fd_date[3] = tp->tm_hour;
dp.fd_date[4] = tp->tm_min;
#endif
rc = _ss_pfd(path, &dp , sizeof(dp));
close(path);
return(rc);
}