#include "charset.h"
#include "coding.h"
#include "window.h"
+#include "blockinput.h"
#ifdef WINDOWSNT
#define NOMINMAX 1
switch (errorno)
{
case EEXIST:
- Fsignal (Qfile_already_exists, Fcons (errstring, data));
+ xsignal (Qfile_already_exists, Fcons (errstring, data));
break;
default:
/* System error messages are capitalized. Downcase the initial
if (SREF (errstring, 1) != '/')
SSET (errstring, 0, DOWNCASE (SREF (errstring, 0)));
- Fsignal (Qfile_error,
+ xsignal (Qfile_error,
Fcons (build_string (string), Fcons (errstring, data)));
}
}
}
else
#endif /* NO_HYPHENS_IN_FILENAMES */
- if (lbrack > rbrack &&
- ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<') &&
- (p[1] == '.' || p[1] == ']' || p[1] == '>')))
+ if (lbrack > rbrack
+ && ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<')
+ && (p[1] == '.' || p[1] == ']' || p[1] == '>')))
lose = 1;
#ifdef NO_HYPHENS_IN_FILENAMES
else
bcopy ((char *) nm, o, p - nm);
o [p - nm] = 0;
+ BLOCK_INPUT;
pw = (struct passwd *) getpwnam (o + 1);
+ UNBLOCK_INPUT;
if (pw)
{
newdir = (unsigned char *) pw -> pw_dir;
else if (*p == '-' && *o != '.')
*--p = '.';
}
- else if (p[0] == '-' && o[-1] == '.' &&
- (p[1] == '.' || p[1] == ']' || p[1] == '>'))
+ else if (p[0] == '-' && o[-1] == '.'
+ && (p[1] == '.' || p[1] == ']' || p[1] == '>'))
/* flush .foo.- ; leave - if stopped by '[' or '<' */
{
do
else
{
#ifdef NO_HYPHENS_IN_FILENAMES
- if (*p == '-' &&
- o[-1] != '[' && o[-1] != '<' && o[-1] != '.' &&
- p[1] != ']' && p[1] != '>' && p[1] != '.')
+ if (*p == '-'
+ && o[-1] != '[' && o[-1] != '<' && o[-1] != '.'
+ && p[1] != ']' && p[1] != '>' && p[1] != '.')
*p = '_';
#endif /* NO_HYPHENS_IN_FILENAMES */
*o++ = *p++;
}
else
#endif /* VMS4_4 */
- if (lbrack > rbrack &&
- ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<') &&
- (p[1] == '.' || p[1] == ']' || p[1] == '>')))
+ if (lbrack > rbrack
+ && ((p[-1] == '.' || p[-1] == '[' || p[-1] == '<')
+ && (p[1] == '.' || p[1] == ']' || p[1] == '>')))
lose = 1;
#ifndef VMS4_4
else
o[len] = 0;
/* Look up the user name. */
+ BLOCK_INPUT;
pw = (struct passwd *) getpwnam (o + 1);
+ UNBLOCK_INPUT;
if (!pw)
error ("\"%s\" isn't a registered user", o + 1);
else if (*p == '-' && *o != '.')
*--p = '.';
}
- else if (p[0] == '-' && o[-1] == '.' &&
- (p[1] == '.' || p[1] == ']' || p[1] == '>'))
+ else if (p[0] == '-' && o[-1] == '.'
+ && (p[1] == '.' || p[1] == ']' || p[1] == '>'))
/* flush .foo.- ; leave - if stopped by '[' or '<' */
{
do
else
{
#ifndef VMS4_4
- if (*p == '-' &&
- o[-1] != '[' && o[-1] != '<' && o[-1] != '.' &&
- p[1] != ']' && p[1] != '>' && p[1] != '.')
+ if (*p == '-'
+ && o[-1] != '[' && o[-1] != '<' && o[-1] != '.'
+ && p[1] != ']' && p[1] != '>' && p[1] != '.')
*p = '_';
#endif /* VMS4_4 */
*o++ = *p++;
o = target;
p++;
}
- else if (p[0] == '/' && p[1] == '.' &&
- (p[2] == '/' || p[2] == 0))
+ else if (p[0] == '/' && p[1] == '.'
+ && (p[2] == '/' || p[2] == 0))
p += 2;
else if (!strncmp (p, "/..", 3)
/* `/../' is the "superroot" on certain file systems. */
/* If we have ~user and `user' exists, discard
everything up to ~. But if `user' does not exist, leave
~user alone, it might be a literal file name. */
- if ((pw = getpwnam (o + 1)))
+ BLOCK_INPUT;
+ pw = getpwnam (o + 1);
+ UNBLOCK_INPUT;
+ if (pw)
return p;
- else
- xfree (pw);
}
else
return p;
if (lstat (SDATA (encoded_filename), &statbuf) >= 0)
{
if (! interactive)
- Fsignal (Qfile_already_exists,
- Fcons (build_string ("File already exists"),
- Fcons (absname, Qnil)));
+ xsignal2 (Qfile_already_exists,
+ build_string ("File already exists"), absname);
GCPRO1 (absname);
tem = format2 ("File %s already exists; %s anyway? ",
absname, build_string (querystring));
tem = do_yes_or_no_p (tem);
UNGCPRO;
if (NILP (tem))
- Fsignal (Qfile_already_exists,
- Fcons (build_string ("File already exists"),
- Fcons (absname, Qnil)));
+ xsignal2 (Qfile_already_exists,
+ build_string ("File already exists"), absname);
if (statptr)
*statptr = statbuf;
}
{
/* Restore original attributes. */
SetFileAttributes (filename, attributes);
- Fsignal (Qfile_date_error,
- Fcons (build_string ("Cannot set file date"),
- Fcons (newname, Qnil)));
+ xsignal2 (Qfile_date_error,
+ build_string ("Cannot set file date"), newname);
}
/* Restore original attributes. */
SetFileAttributes (filename, attributes);
EMACS_SET_SECS_USECS (mtime, st.st_mtime, 0);
if (set_file_times (SDATA (encoded_newname),
atime, mtime))
- Fsignal (Qfile_date_error,
- Fcons (build_string ("Cannot set file date"),
- Fcons (newname, Qnil)));
+ xsignal2 (Qfile_date_error,
+ build_string ("Cannot set file date"), newname);
}
}
#else
if (mkdir (dir, 0777) != 0)
#endif
- report_file_error ("Creating directory", Flist (1, &directory));
+ report_file_error ("Creating directory", list1 (directory));
return Qnil;
}
dir = SDATA (encoded_dir);
if (rmdir (dir) != 0)
- report_file_error ("Removing directory", Flist (1, &directory));
+ report_file_error ("Removing directory", list1 (directory));
return Qnil;
}
GCPRO1 (filename);
if (!NILP (Ffile_directory_p (filename))
&& NILP (Ffile_symlink_p (filename)))
- Fsignal (Qfile_error,
- Fcons (build_string ("Removing old name: is a directory"),
- Fcons (filename, Qnil)));
+ xsignal2 (Qfile_error,
+ build_string ("Removing old name: is a directory"),
+ filename);
UNGCPRO;
filename = Fexpand_file_name (filename, Qnil);
encoded_file = ENCODE_FILE (filename);
if (0 > unlink (SDATA (encoded_file)))
- report_file_error ("Removing old name", Flist (1, &filename));
+ report_file_error ("Removing old name", list1 (filename));
return Qnil;
}
(file, newname, ok_if_already_exists)
Lisp_Object file, newname, ok_if_already_exists;
{
-#ifdef NO_ARG_ARRAY
- Lisp_Object args[2];
-#endif
Lisp_Object handler;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
Lisp_Object encoded_file, encoded_newname, symlink_target;
CHECK_STRING (newname);
file = Fexpand_file_name (file, Qnil);
- if (!NILP (Ffile_directory_p (newname)))
+ if ((!NILP (Ffile_directory_p (newname)))
+#ifdef DOS_NT
+ /* If the file names are identical but for the case,
+ don't attempt to move directory to itself. */
+ && (NILP (Fstring_equal (Fdowncase (file), Fdowncase (newname))))
+#endif
+ )
newname = Fexpand_file_name (Ffile_name_nondirectory (file), newname);
else
newname = Fexpand_file_name (newname, Qnil);
Fdelete_file (file);
}
else
-#ifdef NO_ARG_ARRAY
- {
- args[0] = file;
- args[1] = newname;
- report_file_error ("Renaming", Flist (2, args));
- }
-#else
- report_file_error ("Renaming", Flist (2, &file));
-#endif
+ report_file_error ("Renaming", list2 (file, newname));
}
UNGCPRO;
return Qnil;
(file, newname, ok_if_already_exists)
Lisp_Object file, newname, ok_if_already_exists;
{
-#ifdef NO_ARG_ARRAY
- Lisp_Object args[2];
-#endif
Lisp_Object handler;
Lisp_Object encoded_file, encoded_newname;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
unlink (SDATA (newname));
if (0 > link (SDATA (encoded_file), SDATA (encoded_newname)))
- {
-#ifdef NO_ARG_ARRAY
- args[0] = file;
- args[1] = newname;
- report_file_error ("Adding new name", Flist (2, args));
-#else
- report_file_error ("Adding new name", Flist (2, &file));
-#endif
- }
+ report_file_error ("Adding new name", list2 (file, newname));
UNGCPRO;
return Qnil;
(filename, linkname, ok_if_already_exists)
Lisp_Object filename, linkname, ok_if_already_exists;
{
-#ifdef NO_ARG_ARRAY
- Lisp_Object args[2];
-#endif
Lisp_Object handler;
Lisp_Object encoded_filename, encoded_linkname;
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
}
}
-#ifdef NO_ARG_ARRAY
- args[0] = filename;
- args[1] = linkname;
- report_file_error ("Making symbolic link", Flist (2, args));
-#else
- report_file_error ("Making symbolic link", Flist (2, &filename));
-#endif
+ report_file_error ("Making symbolic link", list2 (filename, linkname));
}
UNGCPRO;
return Qnil;
return Qt;
}
\f
-#ifdef __NetBSD__
-#define unix 42
-#endif
-
-#ifdef unix
+#ifdef HAVE_SYNC
DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "",
doc: /* Tell Unix to finish all pending disk updates. */)
()
return Qnil;
}
-#endif /* unix */
+#endif /* HAVE_SYNC */
DEFUN ("file-newer-than-file-p", Ffile_newer_than_file_p, Sfile_newer_than_file_p, 2, 2, 0,
doc: /* Return t if file FILE1 is newer than file FILE2.
goto notfound;
if (! NILP (replace) || ! NILP (beg) || ! NILP (end))
- Fsignal (Qfile_error,
- Fcons (build_string ("not a regular file"),
- Fcons (orig_filename, Qnil)));
+ xsignal2 (Qfile_error,
+ build_string ("not a regular file"), orig_filename);
}
#endif
}
#endif /* CLASH_DETECTION */
if (not_regular)
- Fsignal (Qfile_error,
- Fcons (build_string ("not a regular file"),
- Fcons (orig_filename, Qnil)));
+ xsignal2 (Qfile_error,
+ build_string ("not a regular file"), orig_filename);
}
if (set_coding_system)
/* ... but with the special flag to indicate not to strip off
leading code of eight-bit-control chars. */
coding->flags = 1;
+ /* We force LF for end-of-line because that is faster. */
+ coding->eol_type = CODING_EOL_LF;
goto done_setup_coding;
}
else if (!NILP (Vcoding_system_for_write))
do_auto_save_make_dir (dir)
Lisp_Object dir;
{
- return call2 (Qmake_directory, dir, Qt);
+ Lisp_Object mode;
+
+ call2 (Qmake_directory, dir, Qt);
+ XSETFASTINT (mode, 0700);
+ return Fset_file_modes (dir, mode);
}
static Lisp_Object
{
/* If we are going to restore an old message,
give time to read ours. */
- sit_for (1, 0, 0, 0, 0);
+ sit_for (make_number (1), 0, 0);
restore_message ();
}
else
if (NILP (action))
{
specdir = Ffile_name_directory (string);
- val = Ffile_name_completion (name, realdir);
+ val = Ffile_name_completion (name, realdir, Vread_file_name_predicate);
UNGCPRO;
if (!STRINGP (val))
{
{
Lisp_Object tem = XCAR (all);
int len;
- if (STRINGP (tem) &&
- (len = SCHARS (tem), len > 0) &&
- IS_DIRECTORY_SEP (SREF (tem, len-1)))
+ if (STRINGP (tem)
+ && (len = SBYTES (tem), len > 0)
+ && IS_DIRECTORY_SEP (SREF (tem, len-1)))
comp = Fcons (tem, comp);
}
}
staticpro (&Qcar_less_than_car);
Fput (Qfile_error, Qerror_conditions,
- Fcons (Qfile_error, Fcons (Qerror, Qnil)));
+ list2 (Qfile_error, Qerror));
Fput (Qfile_error, Qerror_message,
build_string ("File error"));
Fput (Qfile_already_exists, Qerror_conditions,
- Fcons (Qfile_already_exists,
- Fcons (Qfile_error, Fcons (Qerror, Qnil))));
+ list3 (Qfile_already_exists, Qfile_error, Qerror));
Fput (Qfile_already_exists, Qerror_message,
build_string ("File already exists"));
Fput (Qfile_date_error, Qerror_conditions,
- Fcons (Qfile_date_error,
- Fcons (Qfile_error, Fcons (Qerror, Qnil))));
+ list3 (Qfile_date_error, Qfile_error, Qerror));
Fput (Qfile_date_error, Qerror_message,
build_string ("Cannot set file date"));
defsubr (&Sread_file_name);
defsubr (&Snext_read_file_uses_dialog_p);
-#ifdef unix
+#ifdef HAVE_SYNC
defsubr (&Sunix_sync);
#endif
}