In gdb, try to init comint history from gdbhist.
[bpt/emacs.git] / src / filelock.c
index 0ed236f..ae0584c 100644 (file)
@@ -31,10 +31,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #endif
 
 #include <sys/file.h>
-#ifdef HAVE_FCNTL_H
 #include <fcntl.h>
-#endif
-#include <string.h>
 
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>
@@ -117,10 +114,8 @@ Lisp_Object Vtemporary_file_directory;
 static time_t boot_time;
 static int boot_time_initialized;
 
-extern Lisp_Object Vshell_file_name;
-
 #ifdef BOOT_TIME
-static void get_boot_time_1 (char *, int);
+static void get_boot_time_1 (const char *, int);
 #endif
 
 static time_t
@@ -251,7 +246,7 @@ get_boot_time (void)
    Success is indicated by setting BOOT_TIME to a larger value.  */
 
 void
-get_boot_time_1 (char *filename, int newest)
+get_boot_time_1 (const char *filename, int newest)
 {
   struct utmp ut, *utp;
   int desc;
@@ -362,8 +357,8 @@ lock_file_1 (char *lfname, int force)
 {
   register int err;
   time_t boot_time;
-  char *user_name;
-  char *host_name;
+  const char *user_name;
+  const char *host_name;
   char *lock_info_str;
 
   /* Call this first because it can GC.  */
@@ -413,9 +408,6 @@ within_one_second (time_t a, time_t b)
 static int
 current_lock_owner (lock_info_type *owner, char *lfname)
 {
-#ifndef index
-  extern char *rindex (const char *, int), *index (const char *, int);
-#endif
   int len, ret;
   int local_owner = 0;
   char *at, *dot, *colon;
@@ -457,8 +449,8 @@ current_lock_owner (lock_info_type *owner, char *lfname)
 
   /* Parse USER@HOST.PID:BOOT_TIME.  If can't parse, return -1.  */
   /* The USER is everything before the last @.  */
-  at = rindex (lfinfo, '@');
-  dot = rindex (lfinfo, '.');
+  at = strrchr (lfinfo, '@');
+  dot = strrchr (lfinfo, '.');
   if (!at || !dot)
     {
       xfree (lfinfo);
@@ -665,8 +657,7 @@ DEFUN ("lock-buffer", Flock_buffer, Slock_buffer,
        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;
+  (Lisp_Object file)
 {
   if (NILP (file))
     file = current_buffer->file_truename;
@@ -683,7 +674,7 @@ DEFUN ("unlock-buffer", Funlock_buffer, Sunlock_buffer,
        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.  */)
-     ()
+  (void)
 {
   if (SAVE_MODIFF < MODIFF
       && STRINGP (current_buffer->file_truename))
@@ -705,8 +696,7 @@ DEFUN ("file-locked-p", Ffile_locked_p, Sfile_locked_p, 1, 1, 0,
        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 filename)
 {
   Lisp_Object ret;
   register char *lfname;
@@ -740,6 +730,8 @@ init_filelock (void)
   boot_time_initialized = 0;
 }
 
+#endif /* CLASH_DETECTION */
+
 void
 syms_of_filelock (void)
 {
@@ -747,12 +739,12 @@ syms_of_filelock (void)
               doc: /* The directory for writing temporary files.  */);
   Vtemporary_file_directory = Qnil;
 
+#ifdef CLASH_DETECTION
   defsubr (&Sunlock_buffer);
   defsubr (&Slock_buffer);
   defsubr (&Sfile_locked_p);
+#endif
 }
 
-#endif /* CLASH_DETECTION */
-
 /* arch-tag: e062676d-50b2-4be0-ab96-197c81b181a1
    (do not change this comment) */