diff options
| author | Karl Heuer | 1994-09-18 19:13:39 +0000 |
|---|---|---|
| committer | Karl Heuer | 1994-09-18 19:13:39 +0000 |
| commit | 546ec8fb4ceaf02fef96a176a82f9d61bb5a471b (patch) | |
| tree | 658c34be5e7e73b3680f6d60bc2df14a5fe4b659 | |
| parent | f48c727a2403490b67c3e8e13cdabef042eabe6b (diff) | |
| download | emacs-546ec8fb4ceaf02fef96a176a82f9d61bb5a471b.tar.gz emacs-546ec8fb4ceaf02fef96a176a82f9d61bb5a471b.zip | |
(set_file_times): New function.
| -rw-r--r-- | src/sysdep.c | 50 |
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) | |||
| 3023 | 3023 | ||
| 3024 | #endif | 3024 | #endif |
| 3025 | 3025 | ||
| 3026 | #ifdef MISSING_UTIMES | 3026 | int |
| 3027 | 3027 | set_file_times (path, atime, mtime) | |
| 3028 | /* HPUX (among others) sets HAVE_TIMEVAL but does not implement utimes. */ | 3028 | char *path; |
| 3029 | 3029 | EMACS_TIME atime, mtime; | |
| 3030 | utimes () | ||
| 3031 | { | 3030 | { |
| 3032 | } | 3031 | #ifdef HAVE_UTIMES |
| 3032 | struct timeval tv[2]; | ||
| 3033 | tv[0] = atime; | ||
| 3034 | tv[1] = mtime; | ||
| 3035 | return utimes (path, tv); | ||
| 3036 | #else | ||
| 3037 | #ifdef HAVE_UTIME | ||
| 3038 | #ifndef HAVE_STRUCT_UTIMBUF | ||
| 3039 | struct utimbuf { | ||
| 3040 | long actime; | ||
| 3041 | long modtime; | ||
| 3042 | }; | ||
| 3033 | #endif | 3043 | #endif |
| 3034 | |||
| 3035 | #ifdef IRIS_UTIME | ||
| 3036 | |||
| 3037 | /* The IRIS (3.5) has timevals, but uses sys V utime, and doesn't have the | ||
| 3038 | utimbuf structure defined anywhere but in the man page. */ | ||
| 3039 | |||
| 3040 | struct utimbuf | ||
| 3041 | { | ||
| 3042 | long actime; | ||
| 3043 | long modtime; | ||
| 3044 | }; | ||
| 3045 | |||
| 3046 | utimes (name, tvp) | ||
| 3047 | char *name; | ||
| 3048 | struct timeval tvp[]; | ||
| 3049 | { | ||
| 3050 | struct utimbuf utb; | 3044 | struct utimbuf utb; |
| 3051 | utb.actime = tvp[0].tv_sec; | 3045 | utb.actime = EMACS_SECS (atime); |
| 3052 | utb.modtime = tvp[1].tv_sec; | 3046 | utb.modtime = EMACS_SECS (mtime); |
| 3053 | utime (name, &utb); | 3047 | return utime (path, &utb); |
| 3048 | #else /* !HAVE_UTIMES && !HAVE_UTIME */ | ||
| 3049 | /* Should we set errno here? If so, set it to what? */ | ||
| 3050 | return -1; | ||
| 3051 | #endif | ||
| 3052 | #endif | ||
| 3054 | } | 3053 | } |
| 3055 | #endif /* IRIS_UTIME */ | ||
| 3056 | 3054 | ||
| 3057 | 3055 | ||
| 3058 | #ifdef HPUX | 3056 | #ifdef HPUX |