X-Git-Url: https://git.hcoop.net/bpt/emacs.git/blobdiff_plain/5244bc019bf7376caff3bb198ff674e0ad9fb0e6..d3e5c0ea8f4c5902a11b6bc36170336a7a7f01b6:/src/cygw32.c diff --git a/src/cygw32.c b/src/cygw32.c index d9777d5e22..b7386ab8e1 100644 --- a/src/cygw32.c +++ b/src/cygw32.c @@ -1,5 +1,5 @@ /* 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. @@ -23,24 +23,23 @@ along with GNU Emacs. If not, see . */ #include #include -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)); @@ -110,23 +109,25 @@ DEFUN ("cygwin-convert-file-name-to-windows", Fcygwin_convert_file_name_to_windows, Scygwin_convert_file_name_to_windows, 1, 2, 0, - doc: /* Convert PATH to a Windows path. If ABSOLUTE-P is -non-nil, return an absolute path.*/) - (Lisp_Object path, Lisp_Object absolute_p) + doc: /* Convert a Cygwin file name FILE to a Windows-style file name. +If ABSOLUTE-P is non-nil, return an absolute file name. +For the reverse operation, see `cygwin-convert-file-name-from-windows'. */) + (Lisp_Object file, Lisp_Object absolute_p) { return from_unicode ( - conv_filename_to_w32_unicode (path, EQ (absolute_p, Qnil) ? 0 : 1)); + conv_filename_to_w32_unicode (file, EQ (absolute_p, Qnil) ? 0 : 1)); } DEFUN ("cygwin-convert-file-name-from-windows", Fcygwin_convert_file_name_from_windows, Scygwin_convert_file_name_from_windows, 1, 2, 0, - doc: /* Convert a Windows path to a Cygwin path. If ABSOLUTE-P -is non-nil, return an absolute path.*/) - (Lisp_Object path, Lisp_Object absolute_p) + doc: /* Convert a Windows-style file name FILE to a Cygwin file name. +If ABSOLUTE-P is non-nil, return an absolute file name. +For the reverse operation, see `cygwin-convert-file-name-to-windows'. */) + (Lisp_Object file, Lisp_Object absolute_p) { - return conv_filename_from_w32_unicode (to_unicode (path, &path), + return conv_filename_from_w32_unicode (to_unicode (file, &file), EQ (absolute_p, Qnil) ? 0 : 1); }