file.c revision 2c34cafc1c7c5176c3f34dc80ba889c54fdec681
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer * Copyright (C) 2000 Internet Software Consortium.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * Permission to use, copy, modify, and distribute this software for any
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * purpose with or without fee is hereby granted, provided that the above
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * copyright notice and this permission notice appear in all copies.
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt * XXXDCL As the API for accessing file statistics undoubtedly gets expanded,
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt * it might be good to provide a mechanism that allows for the results
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt * of a previous stat() to be used again without having to do another stat.
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt * Such as perl's mechanism of using "_" in place of a file name to indicate
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt * that the results of the last stat should be used. But then you get into
30a60d2aff0ec1810262a8b8efc532e28b32bd57Evan Hunt * annoying MP issues. BTW, Win32 has stat().
28002bd7cb4baa0eab9f47e1e51069c5ea7ea5d4Andreas Gustafssonisc_file_getmodtime(const char *file, isc_time_t *time) {
222d38735f97f771054e223b03f84c5858252332Evan Hunt * XXXDCL some operating systems provide nanoseconds, too,
c3c6770e537ea916265c78d0294ad108233e17c1Michael Sawyer * such as BSD/OS via st_mtimespec.
c634c94d673f1bab17e7f65d332f989b683e712cDavid Lawrence#define TEMPLATE "tmp-XXXXXXXXXX" /* 14 characters. */
222d38735f97f771054e223b03f84c5858252332Evan Huntisc_file_mktemplate(const char *path, char *buf, size_t buflen) {
222d38735f97f771054e223b03f84c5858252332Evan Hunt * Win32 does not have mkstemp.