xref: /netbsd/external/bsd/libbind/dist/bsd/utimes.c (revision 6550d01e)
1 /*	$NetBSD: utimes.c,v 1.1.1.1 2009/04/12 15:33:26 christos Exp $	*/
2 
3 /*
4  * Copyright (c) 2004 by Internet Systems Consortium, Inc. ("ISC")
5  * Copyright (c) 1997,1999 by Internet Software Consortium.
6  *
7  * Permission to use, copy, modify, and distribute this software for any
8  * purpose with or without fee is hereby granted, provided that the above
9  * copyright notice and this permission notice appear in all copies.
10  *
11  * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES
12  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13  * MERCHANTABILITY AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR
14  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
17  * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #include "port_before.h"
21 
22 #include <sys/types.h>
23 #include <sys/time.h>
24 #include <utime.h>
25 
26 #include "port_after.h"
27 
28 #ifndef NEED_UTIMES
29 int __bind_utimes_unneeded;
30 #else
31 
32 int
33 __utimes(char *filename, struct timeval *tvp) {
34 	struct utimbuf utb;
35 
36 	utb.actime = (time_t)tvp[0].tv_sec;
37 	utb.modtime = (time_t)tvp[1].tv_sec;
38 	return (utime(filename, &utb));
39 }
40 
41 #endif /* NEED_UTIMES */
42 /*! \file */
43