1 /***********************************************************************
3 * This software is part of the ast package *
4 * Copyright (c) 1985-2010 AT&T Intellectual Property *
5 * and is licensed under the *
6 * Common Public License, Version 1.0 *
7 * by AT&T Intellectual Property *
9 * A copy of the License is available at *
10 * http://www.opensource.org/licenses/cpl1.0.txt *
11 * (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9) *
13 * Information and Software Systems Research *
17 * Glenn Fowler <gsf@research.att.com> *
18 * David Korn <dgk@research.att.com> *
19 * Phong Vo <kpv@research.att.com> *
21 ***********************************************************************/
27 * touch file access and modify times of file
28 * if flags&PATH_TOUCH_CREATE then file will be created if it doesn't exist
29 * if flags&PATH_TOUCH_VERBATIM then times are taken verbatim
30 * times have one second granularity
32 * (time_t)(-1) retain old time
35 * the old interface flag values were:
37 * -1 PATH_TOUCH_CREATE|PATH_TOUCH_VERBATIM
38 * PATH_TOUCH_VERBATIM -- not supported
46 touch(const char* path
, time_t at
, time_t mt
, int flags
)
53 if (at
== (time_t)(-1) && !(flags
& PATH_TOUCH_VERBATIM
))
55 else if (!at
&& !(flags
& PATH_TOUCH_VERBATIM
))
63 if (mt
== (time_t)(-1) && !(flags
& PATH_TOUCH_VERBATIM
))
65 else if (!mt
&& !(flags
& PATH_TOUCH_VERBATIM
))
73 return tvtouch(path
, ap
, mp
, NiL
, flags
& 1);