Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include "lib.h"
2
#include <sys/types.h>
3
#include <time.h>
4
#include <utime.h>
5
#include <errno.h>
6
#include <stdlib.h>
7
#include "sys9.h"
8
#include "dir.h"
9
 
10
int
11
utime(const char *path, const struct utimbuf *times)
12
{
13
	int n;
14
	Dir nd;
15
	time_t curt;
16
 
17
	_nulldir(&nd);
18
	if(times == 0) {
19
		curt = time(0);
20
		nd.atime = curt;
21
		nd.mtime = curt;
22
	} else {
23
		nd.atime = times->actime;
24
		nd.mtime = times->modtime;
25
	}
26
	n = _dirwstat(path, &nd);
27
	if(n < 0)
28
		_syserrno();
29
	return n;
30
}