]> code.delx.au - gnu-emacs/blobdiff - src/filelock.c
(ibuffer-update-mode-name): Substitute "view time" instead of
[gnu-emacs] / src / filelock.c
index 6e78a05e30954022807059011b236f1f6b4017f6..b85f0a68a0eab52d7b004499195bcf32efe90fe1 100644 (file)
@@ -1,5 +1,5 @@
 /* Lock files for editing.
-   Copyright (C) 1985, 86, 87, 93, 94, 96, 98, 1999, 2000
+   Copyright (C) 1985, 86, 87, 93, 94, 96, 98, 1999, 2000, 2001
    Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
@@ -67,6 +67,10 @@ Lisp_Object Vtemporary_file_directory;
 
 #include <utmp.h>
 
+#if !defined (S_ISLNK) && defined (S_IFLNK)
+#define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
+#endif
+
 /* A file whose last-modified time is just after the most recent boot.
    Define this to be NULL to disable checking for this file.  */
 #ifndef BOOT_TIME_FILE
@@ -435,11 +439,12 @@ current_lock_owner (owner, lfname)
     {
       bufsize *= 2;
       lfinfo = (char *) xrealloc (lfinfo, bufsize);
+      errno = 0;
       len = readlink (lfname, lfinfo, bufsize);
 #ifdef ERANGE
       /* HP-UX reports ERANGE if the buffer is too small.  */
       if (len == -1 && errno == ERANGE)
-       continue;
+       len = bufsize;
 #endif
     }
   while (len >= bufsize);
@@ -672,17 +677,17 @@ unlock_all_files ()
 }
 \f
 DEFUN ("lock-buffer", Flock_buffer, Slock_buffer,
-  0, 1, 0,
-  "Lock FILE, if current buffer is modified.\n\
-FILE defaults to current buffer's visited file,\n\
-or else nothing is done if current buffer isn't visiting a file.")
-  (file)
+       0, 1, 0,
+       doc: /* Lock FILE, if current buffer is modified.
+FILE defaults to current buffer's visited file,
+or else nothing is done if current buffer isn't visiting a file.  */)
+     (file)
      Lisp_Object file;
 {
   if (NILP (file))
     file = current_buffer->file_truename;
   else
-    CHECK_STRING (file, 0);
+    CHECK_STRING (file);
   if (SAVE_MODIFF < MODIFF
       && !NILP (file))
     lock_file (file);
@@ -690,10 +695,11 @@ or else nothing is done if current buffer isn't visiting a file.")
 }
 
 DEFUN ("unlock-buffer", Funlock_buffer, Sunlock_buffer,
-  0, 0, 0,
- "Unlock the file visited in the current buffer,\n\
-if it should normally be locked.")
-  ()
+       0, 0, 0,
+       doc: /* Unlock the file visited in the current buffer.
+If the buffer is not modified, this does nothing because the file
+should not be locked in that case.  */)
+     ()
 {
   if (SAVE_MODIFF < MODIFF
       && STRINGP (current_buffer->file_truename))
@@ -713,10 +719,11 @@ unlock_buffer (buffer)
 }
 
 DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0,
-  "Return nil if the FILENAME is not locked,\n\
-t if it is locked by you, else a string of the name of the locker.")
-  (filename)
-  Lisp_Object filename;
+       doc: /* Return a value indicating whether FILENAME is locked.
+The value is nil if the FILENAME is not locked,
+t if it is locked by you, else a string saying which user has locked it.  */)
+     (filename)
+     Lisp_Object filename;
 {
   Lisp_Object ret;
   register char *lfname;
@@ -754,7 +761,7 @@ void
 syms_of_filelock ()
 {
   DEFVAR_LISP ("temporary-file-directory", &Vtemporary_file_directory,
-    "The directory for writing temporary files.");
+              doc: /* The directory for writing temporary files.  */);
   Vtemporary_file_directory = Qnil;
 
   defsubr (&Sunlock_buffer);