3 * Operating System specific function (Windows NT)
5 * $Header: winnt.c 1.0 94/11/09 $
7 * Revision 1.0 94/11/09 10:04:00 auj
15 #include <sys/utime.h>
21 * return the length of a file
24 filesize(char *pathname
)
28 if (stat(pathname
, &statb
) < 0)
30 return (Word
) statb
.st_size
;;
34 * test for the existance of a file or directory
41 if (stat(pathname
, &statb
) < 0)
44 if (statb
.st_mode
& S_IFDIR
)
54 makedir(char *pathname
)
56 return _mkdir(pathname
);
60 * stamp a file with date and time
63 filestamp(Header
*header
, char *filename
)
67 struct utimbuf utimbuf
;
70 if (exist(filename
) == ISDIR
)
71 return (0); /* Win NT appears not to allow stamping dirs. */
73 if ((header
->load
& (Word
) 0xfff00000) != (Word
) 0xfff00000)
74 return (0); /* not a timestamp */
76 memset((char *) &tm
, '\0', sizeof(tm
));
78 if (!(date
= makedate(header
)))
81 tm
.tm_sec
= date
->second
;
82 tm
.tm_min
= date
->minute
;
83 tm
.tm_hour
= date
->hour
;
84 tm
.tm_mday
= date
->day
;
85 tm
.tm_mon
= date
->month
- 1;
86 tm
.tm_year
= date
->year
;
87 filetime
= mktime(&tm
);
89 utimbuf
.actime
= filetime
;
90 utimbuf
.modtime
= filetime
;
91 return (utime(filename
, &utimbuf
));