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>
20 * return the length of a file
23 filesize(char *pathname
)
27 if (stat(pathname
, &statb
) < 0)
29 return (Word
) statb
.st_size
;;
33 * test for the existance of a file or directory
40 if (stat(pathname
, &statb
) < 0)
43 if (statb
.st_mode
& S_IFDIR
)
53 makedir(char *pathname
)
55 return mkdir(pathname
);
59 * stamp a file with date and time
62 filestamp(Header
*header
, char *filename
)
66 struct utimbuf utimbuf
;
69 if (exist(filename
) == ISDIR
)
70 return (0); /* Win NT appears not to allow stamping dirs. */
72 if ((header
->load
& (Word
) 0xfff00000) != (Word
) 0xfff00000)
73 return (0); /* not a timestamp */
75 memset((char *) &tm
, '\0', sizeof(tm
));
77 if (!(date
= makedate(header
)))
80 tm
.tm_sec
= date
->second
;
81 tm
.tm_min
= date
->minute
;
82 tm
.tm_hour
= date
->hour
;
83 tm
.tm_mday
= date
->day
;
84 tm
.tm_mon
= date
->month
- 1;
85 tm
.tm_year
= date
->year
;
86 filetime
= mktime(&tm
);
88 utimbuf
.actime
= filetime
;
89 utimbuf
.modtime
= filetime
;
90 return (utime(filename
, &utimbuf
));