/* Need to lower-case the drive letter, or else expanded
filenames will sometimes compare inequal, because
`expand-file-name' doesn't always down-case the drive letter. */
-#define DRIVE_LETTER(x) (tolower (x))
+#define DRIVE_LETTER(x) tolower (x)
#endif /* WINDOWSNT */
int lisp_to_time (Lisp_Object, time_t *);
int disable_auto_save_when_buffer_shrinks;
-Lisp_Object Qfile_name_handler_alist;
-
Lisp_Object Vdirectory_sep_char;
/* These variables describe handlers that have "already" had a chance
signal handler) because that's way too losing.
(#### Actually, longjmp()ing out of the signal handler may not be
- as losing as I thought. See sys_do_signal() in sysdep.c.)
+ as losing as I thought. See sys_do_signal() in sysdep.c.) */
- Solaris include files declare the return value as ssize_t.
- Is that standard? */
-int
+ssize_t
read_allowing_quit (int fildes, void *buf, size_t size)
{
QUIT;
return sys_read_1 (fildes, buf, size, 1);
}
-int
+ssize_t
write_allowing_quit (int fildes, CONST void *buf, size_t size)
{
QUIT;
if (IS_DIRECTORY_SEP (nm[1])
|| nm[1] == 0) /* ~ by itself */
{
- if (!(newdir = (Bufbyte *) get_home_directory()))
+ char * newdir_external = get_home_directory ();
+
+ if (newdir_external == NULL)
newdir = (Bufbyte *) "";
+ else
+ GET_C_CHARPTR_INT_FILENAME_DATA_ALLOCA (newdir_external, newdir);
+
nm++;
#ifdef WINDOWSNT
collapse_newdir = 0;
if ((user = user_login_name (NULL)) != NULL)
{
/* Does the user login name match the ~name? */
- if (strcmp(user,((char *) o + 1)) == 0)
+ if (strcmp (user, (char *) o + 1) == 0)
{
- newdir = (Bufbyte *) get_home_directory();
+ newdir = (Bufbyte *) get_home_directory();
nm = p;
}
}
}
else
{
- if (!(IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1])))
- abort ();
+ assert (IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1]));
}
CORRECT_DIR_SEPS (target);
#endif /* WINDOWSNT */
{
char resolved_path[MAXPATHLEN];
- char path[MAXPATHLEN];
- char *p = path;
- int elen = XSTRING_LENGTH (expanded_name);
+ Extbyte *path;
+ Extbyte *p;
+ Extcount elen = XSTRING_LENGTH (expanded_name);
- if (elen >= countof (path))
+ GET_STRING_FILENAME_DATA_ALLOCA (expanded_name,path,elen);
+ p = path;
+ if (elen > MAXPATHLEN)
goto toolong;
-
- memcpy (path, XSTRING_DATA (expanded_name), elen + 1);
- /* memset (resolved_path, 0, sizeof (resolved_path)); */
-
+
/* Try doing it all at once. */
- /* !!#### Does realpath() Mule-encapsulate? */
- if (!xrealpath (path, resolved_path))
+ /* !! Does realpath() Mule-encapsulate?
+ Answer: Nope! So we do it above */
+ if (!xrealpath ((char *) path, resolved_path))
{
/* Didn't resolve it -- have to do it one component at a time. */
/* "realpath" is a typically useless, stupid un*x piece of crap.
partial result returned. What a piece of junk. */
for (;;)
{
- p = (char *) memchr (p + 1, '/', elen - (p + 1 - path));
+ p = (Extbyte *) memchr (p + 1, '/', elen - (p + 1 - path));
if (p)
*p = 0;
/* memset (resolved_path, 0, sizeof (resolved_path)); */
- if (xrealpath (path, resolved_path))
+ if (xrealpath ((char *) path, resolved_path))
{
if (p)
*p = '/';
Fcopy_file (filename, newname,
/* We have already prompted if it was an integer,
so don't have copy-file prompt again. */
- ((NILP (ok_if_already_exists)) ? Qnil : Qt),
+ (NILP (ok_if_already_exists) ? Qnil : Qt),
Qt);
Fdelete_file (filename);
}
occurs inside of the filedesc stream. */
while (1)
{
- Bytecount this_len;
+ ssize_t this_len;
Charcount cc_inserted;
QUIT;
run_hook (Qauto_save_hook);
- if (GC_STRINGP (Vauto_save_list_file_name))
+ if (STRINGP (Vauto_save_list_file_name))
listfile = condition_case_1 (Qt,
auto_save_expand_name,
Vauto_save_list_file_name,
for (do_handled_files = 0; do_handled_files < 2; do_handled_files++)
{
for (tail = Vbuffer_alist;
- GC_CONSP (tail);
+ CONSP (tail);
tail = XCDR (tail))
{
buf = XCDR (XCAR (tail));
b = XBUFFER (buf);
- if (!GC_NILP (current_only)
+ if (!NILP (current_only)
&& b != current_buffer)
continue;
/* Check for auto save enabled
and file changed since last auto save
and file changed since last real save. */
- if (GC_STRINGP (b->auto_save_file_name)
+ if (STRINGP (b->auto_save_file_name)
&& BUF_SAVE_MODIFF (b) < BUF_MODIFF (b)
&& b->auto_save_modified < BUF_MODIFF (b)
/* -1 means we've turned off autosaving for a while--see below. */
continue;
}
set_buffer_internal (b);
- if (!auto_saved && GC_NILP (no_message))
+ if (!auto_saved && NILP (no_message))
{
static CONST unsigned char *msg
= (CONST unsigned char *) "Auto-saving...";
/* Open the auto-save list file, if necessary.
We only do this now so that the file only exists
if we actually auto-saved any files. */
- if (!auto_saved && GC_STRINGP (listfile) && listdesc < 0)
+ if (!auto_saved && STRINGP (listfile) && listdesc < 0)
{
listdesc = open ((char *) XSTRING_DATA (listfile),
O_WRONLY | O_TRUNC | O_CREAT | OPEN_BINARY,
one because nothing needed to be auto-saved. Do this afterwards
rather than before in case we get a crash attempting to autosave
(in that case we'd still want the old one around). */
- if (listdesc < 0 && !auto_saved && GC_STRINGP (listfile))
+ if (listdesc < 0 && !auto_saved && STRINGP (listfile))
unlink ((char *) XSTRING_DATA (listfile));
/* Show "...done" only if the echo area would otherwise be empty. */
defsymbol (&Qset_visited_file_modtime, "set-visited-file-modtime");
defsymbol (&Qcar_less_than_car, "car-less-than-car"); /* Vomitous! */
- defsymbol (&Qfile_name_handler_alist, "file-name-handler-alist");
defsymbol (&Qauto_save_hook, "auto-save-hook");
defsymbol (&Qauto_save_error, "auto-save-error");
defsymbol (&Qauto_saving, "auto-saving");
on other platforms, it is initialized so that Lisp code can find out
what the normal separator is.
*/ );
- Vdirectory_sep_char = make_char ('/');
+#ifdef WINDOWSNT
+ Vdirectory_sep_char = make_char ('\\');
+#else
+ Vdirectory_sep_char = make_char ('/');
+#endif
}