/* Cygwin support routines.
- Copyright (C) 2011-2012 Free Software Foundation, Inc.
+ Copyright (C) 2011-2014 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <unistd.h>
#include <fcntl.h>
-static Lisp_Object
-fchdir_unwind (Lisp_Object dir_fd)
+static void
+fchdir_unwind (int dir_fd)
{
- (void) fchdir (XFASTINT (dir_fd));
- (void) close (XFASTINT (dir_fd));
- return Qnil;
+ (void) fchdir (dir_fd);
+ (void) close (dir_fd);
}
static void
chdir_to_default_directory ()
{
Lisp_Object new_cwd;
- int old_cwd_fd = open (".", O_RDONLY | O_DIRECTORY);
+ int old_cwd_fd = emacs_open (".", O_RDONLY | O_DIRECTORY, 0);
if (old_cwd_fd == -1)
error ("could not open current directory: %s", strerror (errno));
- record_unwind_protect (fchdir_unwind, make_number (old_cwd_fd));
+ record_unwind_protect_int (fchdir_unwind, old_cwd_fd);
new_cwd = Funhandled_file_name_directory (
Fexpand_file_name (build_string ("."), Qnil));
ssize_t converted_len;
Lisp_Object converted;
unsigned flags;
- int count = SPECPDL_INDEX ();
+ dynwind_begin ();
chdir_to_default_directory ();
SDATA (converted), converted_len))
error ("cygwin_conv_path: %s", strerror (errno));
- return unbind_to (count, converted);
+ dynwind_end ();
+ return converted;
}
static Lisp_Object
ssize_t converted_len;
Lisp_Object converted;
unsigned flags;
- int count = SPECPDL_INDEX ();
+ dynwind_begin ();
chdir_to_default_directory ();
if (cygwin_conv_path (flags, in, SDATA (converted), converted_len))
error ("cygwin_conv_path: %s", strerror (errno));
- return unbind_to (count, DECODE_FILE (converted));
+ Lisp_Object tem0 = DECODE_FILE (converted);
+ dynwind_end ();
+ return tem0;
}
DEFUN ("cygwin-convert-file-name-to-windows",
void
syms_of_cygw32 (void)
{
- defsubr (&Scygwin_convert_file_name_from_windows);
- defsubr (&Scygwin_convert_file_name_to_windows);
+#include "cygw32.x"
}