Skip to content

Commit

Permalink
Fix windows compile error.
Browse files Browse the repository at this point in the history
  • Loading branch information
crlf0710 committed Jan 20, 2017
1 parent 565fe0f commit 894a22b
Show file tree
Hide file tree
Showing 3 changed files with 93 additions and 57 deletions.
3 changes: 2 additions & 1 deletion src/callproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1215,7 +1215,7 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
report_file_error ("Spawning child process", Qnil);
return cpid;

#endif /* not WINDOWSNT */
#else /* not WINDOWSNT */

#ifndef MSDOS

Expand All @@ -1234,6 +1234,7 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
int errnum = emacs_exec_file (new_argv[0], new_argv, env);
exec_failed (new_argv[0], errnum);

#endif /* MSDOS */
#endif /* not WINDOWSNT */
}

Expand Down
87 changes: 59 additions & 28 deletions src/fileio.c
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#ifdef DOS_NT
/* On Windows, drive letters must be alphabetic - on DOS, the Netware
redirector allows the six letters between 'Z' and 'a' as well. */
#ifdef WINDOWSNT
#define IS_DRIVE(x) c_isalpha (x)
#endif
/* Need to lower-case the drive letter, or else expanded
filenames will sometimes compare unequal, because
`expand-file-name' doesn't always down-case the drive letter. */
Expand Down Expand Up @@ -126,7 +129,8 @@ static bool a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
static bool e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t,
struct coding_system *);




/* Return true if FILENAME exists. */

static bool
Expand Down Expand Up @@ -166,7 +170,8 @@ check_writable (const char *filename, int amode)
#endif /* CYGWIN */
return res;
}



/* Signal a file-access failure. STRING describes the failure,
NAME the file involved, and ERRORNO the errno value.
Expand Down Expand Up @@ -239,7 +244,8 @@ restore_point_unwind (Lisp_Object location)
unchain_marker (XMARKER (location));
}




DEFUN ("find-file-name-handler", Ffind_file_name_handler,
Sfind_file_name_handler, 2, 2, 0,
doc: /* Return FILENAME's handler function for OPERATION, if it has one.
Expand Down Expand Up @@ -300,7 +306,8 @@ use the standard functions without calling themselves recursively. */)
}
return result;
}



DEFUN ("file-name-directory", Ffile_name_directory, Sfile_name_directory,
1, 1, 0,
doc: /* Return the directory component in file name FILENAME.
Expand Down Expand Up @@ -536,7 +543,8 @@ is already present. */)
SAFE_FREE ();
return val;
}



/* Convert from directory name SRC of length SRCLEN to file name in
DST. MULTIBYTE non-zero means the file name in SRC is a multibyte
string. On UNIX, just make sure there isn't a terminating /.
Expand Down Expand Up @@ -1600,7 +1608,8 @@ See also the function `substitute-in-file-name'.")
return make_string (target, o - target);
}
#endif



/* If /~ or // appears, discard everything through first slash. */
static bool
file_name_absolute_p (const char *filename)
Expand Down Expand Up @@ -1765,7 +1774,8 @@ those `/' is discarded. */)
SAFE_FREE ();
return filename;
}



/* A slightly faster and more convenient way to get
(directory-file-name (expand-file-name FOO)). */

Expand All @@ -1785,7 +1795,8 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir)
absname = Fdirectory_file_name (absname);
return absname;
}



/* Signal an error if the file ABSNAME already exists.
If KNOWN_TO_EXIST, the file is known to exist.
QUERYSTRING is a name for the action that is being considered
Expand Down Expand Up @@ -2100,7 +2111,8 @@ permissions. */)

return Qnil;
}



DEFUN ("make-directory-internal", Fmake_directory_internal,
Smake_directory_internal, 1, 1, 0,
doc: /* Create a new directory named DIRECTORY. */)
Expand Down Expand Up @@ -2207,7 +2219,8 @@ internal_delete_file (Lisp_Object filename)
Qt, internal_delete_file_1);
return NILP (tem);
}



/* Filesystems are case-sensitive on all supported systems except
MS-Windows, MS-DOS, Cygwin, and Mac OS X. They are always
case-insensitive on the first two, but they may or may not be
Expand Down Expand Up @@ -2519,7 +2532,8 @@ This happens for interactive use with M-x. */)
return Qnil;
}




DEFUN ("file-name-absolute-p", Ffile_name_absolute_p, Sfile_name_absolute_p,
1, 1, 0,
doc: /* Return t if file FILENAME specifies an absolute file name.
Expand All @@ -2529,7 +2543,8 @@ On Unix, this is a name starting with a `/' or a `~'. */)
CHECK_STRING (filename);
return file_name_absolute_p (SSDATA (filename)) ? Qt : Qnil;
}



DEFUN ("file-exists-p", Ffile_exists_p, Sfile_exists_p, 1, 1, 0,
doc: /* Return t if file FILENAME exists (whether or not you can read it.)
See also `file-readable-p' and `file-attributes'.
Expand Down Expand Up @@ -2639,7 +2654,8 @@ DEFUN ("file-writable-p", Ffile_writable_p, Sfile_writable_p, 1, 1, 0,
return check_writable (SSDATA (dir), W_OK | X_OK) ? Qt : Qnil;
#endif
}



DEFUN ("access-file", Faccess_file, Saccess_file, 2, 2, 0,
doc: /* Access file FILENAME, and get an error if that does not work.
The second argument STRING is used in the error message.
Expand All @@ -2666,7 +2682,8 @@ If there is no error, returns nil. */)

return Qnil;
}



/* Relative to directory FD, return the symbolic link value of FILENAME.
On failure, return nil. */
Lisp_Object
Expand Down Expand Up @@ -2876,7 +2893,8 @@ See `file-symlink-p' to distinguish symlinks. */)
return S_ISREG (st.st_mode) ? Qt : Qnil;
#endif
}



DEFUN ("file-selinux-context", Ffile_selinux_context,
Sfile_selinux_context, 1, 1, 0,
doc: /* Return SELinux context of file named FILENAME.
Expand Down Expand Up @@ -2931,7 +2949,8 @@ or if SELinux is disabled, or if Emacs lacks SELinux support. */)

return list4 (user, role, type, range);
}



DEFUN ("set-file-selinux-context", Fset_file_selinux_context,
Sset_file_selinux_context, 2, 2, 0,
doc: /* Set SELinux context of file named FILENAME to CONTEXT.
Expand Down Expand Up @@ -3016,7 +3035,8 @@ or if Emacs was not compiled with SELinux support. */)

return Qnil;
}



DEFUN ("file-acl", Ffile_acl, Sfile_acl, 1, 1, 0,
doc: /* Return ACL entries of file named FILENAME.
The entries are returned in a format suitable for use in `set-file-acl'
Expand Down Expand Up @@ -3126,7 +3146,8 @@ support. */)

return Qnil;
}



DEFUN ("file-modes", Ffile_modes, Sfile_modes, 1, 1, 0,
doc: /* Return mode bits of file named FILENAME, as an integer.
Return nil, if file does not exist or is not accessible. */)
Expand Down Expand Up @@ -3211,7 +3232,8 @@ The value is an integer. */)
XSETINT (value, (~ realmask) & 0777);
return value;
}




DEFUN ("set-file-times", Fset_file_times, Sset_file_times, 1, 2, 0,
doc: /* Set times of file FILENAME to TIMESTAMP.
Expand Down Expand Up @@ -3244,7 +3266,8 @@ Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of

return Qt;
}



#ifdef HAVE_SYNC
DEFUN ("unix-sync", Funix_sync, Sunix_sync, 0, 0, "",
doc: /* Tell Unix to finish all pending disk updates. */)
Expand Down Expand Up @@ -3293,7 +3316,8 @@ otherwise, if FILE2 does not exist, the answer is t. */)
return (timespec_cmp (get_stat_mtime (&st2), get_stat_mtime (&st1)) < 0
? Qt : Qnil);
}



#ifndef READ_BUF_SIZE
#define READ_BUF_SIZE (64 << 10)
#endif
Expand Down Expand Up @@ -4609,7 +4633,8 @@ by calling `format-decode', which see. */)

return unbind_to (count, val);
}



static Lisp_Object build_annotations (Lisp_Object, Lisp_Object);

static void
Expand Down Expand Up @@ -5122,7 +5147,8 @@ write_region (Lisp_Object start, Lisp_Object end, Lisp_Object filename,

return Qnil;
}



DEFUN ("car-less-than-car", Fcar_less_than_car, Scar_less_than_car, 2, 2, 0,
doc: /* Return t if (car A) is numerically less than (car B). */)
(Lisp_Object a, Lisp_Object b)
Expand Down Expand Up @@ -5213,7 +5239,8 @@ build_annotations (Lisp_Object start, Lisp_Object end)
return annotations;
}




/* Write to descriptor DESC the NCHARS chars starting at POS of STRING.
If STRING is nil, POS is the character position in the current buffer.
Intersperse with them the annotations from *ANNOT
Expand Down Expand Up @@ -5370,7 +5397,8 @@ e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end,

return 1;
}



DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime,
Sverify_visited_file_modtime, 0, 1, 0,
doc: /* Return t if last mod time of BUF's visited file matches what BUF records.
Expand Down Expand Up @@ -5474,7 +5502,8 @@ An argument specifies the modification time value to use

return Qnil;
}



static Lisp_Object
auto_save_error (Lisp_Object error_val)
{
Expand Down Expand Up @@ -5811,7 +5840,8 @@ before any other event (mouse or keypress) is handled. */)
return Qnil;
}




DEFUN ("set-binary-mode", Fset_binary_mode, Sset_binary_mode, 2, 2, 0,
doc: /* Switch STREAM to binary I/O mode or text I/O mode.
STREAM can be one of the symbols `stdin', `stdout', or `stderr'.
Expand Down Expand Up @@ -5852,7 +5882,8 @@ effect except for flushing STREAM's data. */)

return (set_binary_mode (fileno (fp), binmode) == O_BINARY) ? Qt : Qnil;
}



void
init_fileio (void)
{
Expand Down
Loading

0 comments on commit 894a22b

Please sign in to comment.