1 |
greg |
2.1 |
#ifndef lint |
2 |
greg |
2.5 |
static const char RCSid[] = "$Id$"; |
3 |
greg |
2.1 |
#endif |
4 |
|
|
/* |
5 |
|
|
* Return file date (UNIX seconds as returned by time(2) call) |
6 |
greg |
2.5 |
* |
7 |
|
|
* External symbols declared in standard.h |
8 |
|
|
*/ |
9 |
|
|
|
10 |
greg |
2.6 |
#include "copyright.h" |
11 |
greg |
2.1 |
|
12 |
|
|
#include <sys/types.h> |
13 |
|
|
#include <sys/stat.h> |
14 |
|
|
|
15 |
|
|
|
16 |
greg |
2.3 |
time_t |
17 |
greg |
2.1 |
fdate(fname) /* get file date */ |
18 |
|
|
char *fname; |
19 |
|
|
{ |
20 |
|
|
struct stat sbuf; |
21 |
|
|
|
22 |
|
|
if (stat(fname, &sbuf) == -1) |
23 |
greg |
2.2 |
return(0); |
24 |
greg |
2.1 |
|
25 |
|
|
return(sbuf.st_mtime); |
26 |
greg |
2.4 |
} |
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 |
greg |
2.1 |
} |