/* 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.
#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
{
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);
}
\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);
}
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))
}
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;
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);