comparison src/filelock.c @ 485:8c615e453683

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Mon, 13 Jan 1992 21:48:08 +0000
parents 481e29c1e27e
children 65e7f842d017
comparison
equal deleted inserted replaced
484:3165b2697c78 485:8c615e453683
31 #include <sys/file.h> 31 #include <sys/file.h>
32 #ifdef USG 32 #ifdef USG
33 #include <fcntl.h> 33 #include <fcntl.h>
34 #endif /* USG */ 34 #endif /* USG */
35 35
36 #undef NULL
37 #include "lisp.h" 36 #include "lisp.h"
38 #include "paths.h" 37 #include "paths.h"
39 #include "buffer.h" 38 #include "buffer.h"
40 39
41 extern int errno; 40 extern int errno;
96 fill_in_lock_file_name (lfname, fn); 95 fill_in_lock_file_name (lfname, fn);
97 96
98 /* See if this file is visited and has changed on disk since it was visited. */ 97 /* See if this file is visited and has changed on disk since it was visited. */
99 { 98 {
100 register Lisp_Object subject_buf = Fget_file_buffer (fn); 99 register Lisp_Object subject_buf = Fget_file_buffer (fn);
101 if (!NULL (subject_buf) 100 if (!NILP (subject_buf)
102 && NULL (Fverify_visited_file_modtime (subject_buf)) 101 && NILP (Fverify_visited_file_modtime (subject_buf))
103 && !NULL (Ffile_exists_p (fn))) 102 && !NILP (Ffile_exists_p (fn)))
104 call1 (intern ("ask-user-about-supersession-threat"), fn); 103 call1 (intern ("ask-user-about-supersession-threat"), fn);
105 } 104 }
106 105
107 /* Try to lock the lock. */ 106 /* Try to lock the lock. */
108 if (lock_if_free (lfname) <= 0) 107 if (lock_if_free (lfname) <= 0)
110 return; 109 return;
111 110
112 /* Else consider breaking the lock */ 111 /* Else consider breaking the lock */
113 attack = call2 (intern ("ask-user-about-lock"), fn, 112 attack = call2 (intern ("ask-user-about-lock"), fn,
114 lock_file_owner_name (lfname)); 113 lock_file_owner_name (lfname));
115 if (!NULL (attack)) 114 if (!NILP (attack))
116 /* User says take the lock */ 115 /* User says take the lock */
117 { 116 {
118 lock_superlock (lfname); 117 lock_superlock (lfname);
119 lock_file_1 (lfname, O_WRONLY) ; 118 lock_file_1 (lfname, O_WRONLY) ;
120 unlink (PATH_SUPERLOCK); 119 unlink (PATH_SUPERLOCK);
296 FILE defaults to current buffer's visited file,\n\ 295 FILE defaults to current buffer's visited file,\n\
297 or else nothing is done if current buffer isn't visiting a file.") 296 or else nothing is done if current buffer isn't visiting a file.")
298 (fn) 297 (fn)
299 Lisp_Object fn; 298 Lisp_Object fn;
300 { 299 {
301 if (NULL (fn)) 300 if (NILP (fn))
302 fn = current_buffer->filename; 301 fn = current_buffer->filename;
303 else 302 else
304 CHECK_STRING (fn, 0); 303 CHECK_STRING (fn, 0);
305 if (current_buffer->save_modified < MODIFF 304 if (current_buffer->save_modified < MODIFF
306 && !NULL (fn)) 305 && !NILP (fn))
307 lock_file (fn); 306 lock_file (fn);
308 return Qnil; 307 return Qnil;
309 } 308 }
310 309
311 DEFUN ("unlock-buffer", Funlock_buffer, Sunlock_buffer, 310 DEFUN ("unlock-buffer", Funlock_buffer, Sunlock_buffer,