summaryrefslogtreecommitdiff
path: root/src/sysdep.c
diff options
context:
space:
mode:
authorKarl Heuer <kwzh@gnu.org>1994-09-18 19:13:39 +0000
committerKarl Heuer <kwzh@gnu.org>1994-09-18 19:13:39 +0000
commit48ed5f2fa27122a13e12dfc62d2c58b9184b6d60 (patch)
tree04b0a8f9371b499ccc8c246905fda0094a2c3337 /src/sysdep.c
parent9e6d7fe216efcc7c3a50c1a29270faa6b2ecb881 (diff)
downloademacs-48ed5f2fa27122a13e12dfc62d2c58b9184b6d60.tar.gz
(set_file_times): New function.
Diffstat (limited to 'src/sysdep.c')
-rw-r--r--src/sysdep.c50
1 files changed, 24 insertions, 26 deletions
diff --git a/src/sysdep.c b/src/sysdep.c
index e670958289f..85076908f16 100644
--- a/src/sysdep.c
+++ b/src/sysdep.c
@@ -3023,36 +3023,34 @@ rename (from, to)
#endif
-#ifdef MISSING_UTIMES
-
-/* HPUX (among others) sets HAVE_TIMEVAL but does not implement utimes. */
-
-utimes ()
+int
+set_file_times (path, atime, mtime)
+ char *path;
+ EMACS_TIME atime, mtime;
{
-}
+#ifdef HAVE_UTIMES
+ struct timeval tv[2];
+ tv[0] = atime;
+ tv[1] = mtime;
+ return utimes (path, tv);
+#else
+#ifdef HAVE_UTIME
+#ifndef HAVE_STRUCT_UTIMBUF
+ struct utimbuf {
+ long actime;
+ long modtime;
+ };
#endif
-
-#ifdef IRIS_UTIME
-
-/* The IRIS (3.5) has timevals, but uses sys V utime, and doesn't have the
- utimbuf structure defined anywhere but in the man page. */
-
-struct utimbuf
- {
- long actime;
- long modtime;
- };
-
-utimes (name, tvp)
- char *name;
- struct timeval tvp[];
-{
struct utimbuf utb;
- utb.actime = tvp[0].tv_sec;
- utb.modtime = tvp[1].tv_sec;
- utime (name, &utb);
+ utb.actime = EMACS_SECS (atime);
+ utb.modtime = EMACS_SECS (mtime);
+ return utime (path, &utb);
+#else /* !HAVE_UTIMES && !HAVE_UTIME */
+ /* Should we set errno here? If so, set it to what? */
+ return -1;
+#endif
+#endif
}
-#endif /* IRIS_UTIME */
#ifdef HPUX