1 |
#ifndef lint |
2 |
static const char RCSid[] = "$Id$"; |
3 |
#endif |
4 |
/* |
5 |
* Return file date (UNIX seconds as returned by time(2) call) |
6 |
* |
7 |
* External symbols declared in standard.h |
8 |
*/ |
9 |
|
10 |
#include "copyright.h" |
11 |
|
12 |
#include <sys/types.h> |
13 |
#include <sys/stat.h> |
14 |
|
15 |
|
16 |
time_t |
17 |
fdate(fname) /* get file date */ |
18 |
char *fname; |
19 |
{ |
20 |
struct stat sbuf; |
21 |
|
22 |
if (stat(fname, &sbuf) == -1) |
23 |
return(0); |
24 |
|
25 |
return(sbuf.st_mtime); |
26 |
} |
27 |
|
28 |
|
29 |
int |
30 |
setfdate(fname, ftim) /* set file date */ |
31 |
char *fname; |
32 |
long ftim; |
33 |
{ |
34 |
time_t ftm[2]; |
35 |
|
36 |
ftm[0] = ftm[1] = ftim; |
37 |
|
38 |
return(utime(fname, ftm)); |
39 |
} |