/* Process support for GNU Emacs on the Microsoft W32 API.
Copyright (C) 1992, 1995, 1999, 2000, 2001, 2002, 2003, 2004, 2005,
- 2006, 2007, 2008 Free Software Foundation, Inc.
+ 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <fcntl.h>
#include <signal.h>
#include <sys/file.h>
+#include <setjmp.h>
/* must include CRT headers *before* config.h */
#include <windows.h>
#ifdef __GNUC__
/* This definition is missing from mingw32 headers. */
-extern BOOL WINAPI IsValidLocale(LCID, DWORD);
+extern BOOL WINAPI IsValidLocale (LCID, DWORD);
#endif
#ifdef HAVE_LANGINFO_CODESET
child_process *cp;
DWORD id;
- for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--)
+ for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
if (!CHILD_ACTIVE (cp))
goto Initialise;
if (child_proc_count == MAX_CHILDREN)
cp = &child_procs[child_proc_count++];
Initialise:
- memset (cp, 0, sizeof(*cp));
+ memset (cp, 0, sizeof (*cp));
cp->fd = -1;
cp->pid = -1;
cp->procinfo.hProcess = NULL;
{
child_process *cp;
- for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--)
+ for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
if (CHILD_ACTIVE (cp) && pid == cp->pid)
return cp;
return NULL;
return TRUE;
EH_Fail:
- DebPrint (("create_child.CreateProcess failed: %ld\n", GetLastError()););
+ DebPrint (("create_child.CreateProcess failed: %ld\n", GetLastError ()););
return FALSE;
}
}
else
{
- for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--)
+ for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
/* some child_procs might be sockets; ignore them */
if (CHILD_ACTIVE (cp) && cp->procinfo.hProcess
&& (cp->fd < 0 || (fd_info[cp->fd].flags & FILE_AT_EOF) != 0))
Note that using backslash to escape embedded quotes requires
additional special handling if an embedded quote is already
- preceeded by backslash, or if an arg requiring quoting ends with
+ preceded by backslash, or if an arg requiring quoting ends with
backslash. In such cases, the run of escape characters needs to be
doubled. For consistency, we apply this special handling as long
as the escape character is not quote.
escape_char = is_cygnus_app ? '"' : '\\';
}
- /* Cygwin apps needs quoting a bit more often */
+ /* Cygwin apps needs quoting a bit more often. */
if (escape_char == '"')
sepchars = "\r\n\t\f '";
count_children:
/* Add handles of child processes. */
nc = 0;
- for (cp = child_procs+(child_proc_count-1); cp >= child_procs; cp--)
+ for (cp = child_procs + (child_proc_count-1); cp >= child_procs; cp--)
/* Some child_procs might be sockets; ignore them. Also some
children may have died already, but we haven't finished reading
the process output; ignore them too. */
the winsock local hostname is returned (since this may be different from
the value of `system-name' and should supplant it), otherwise t is
returned to indicate winsock support is present. */)
- (load_now)
+ (load_now)
Lisp_Object load_now;
{
int have_winsock;
doc: /* Return the long file name version of the full path of FILENAME.
If FILENAME does not exist, return nil.
All path elements in FILENAME are converted to their long names. */)
- (filename)
+ (filename)
Lisp_Object filename;
{
char longname[ MAX_PATH ];
any other symbol will be interpreted as normal.
If successful, the return value is t, otherwise nil. */)
- (process, priority)
+ (process, priority)
Lisp_Object process, priority;
{
HANDLE proc_handle = GetCurrentProcess ();
#ifdef HAVE_LANGINFO_CODESET
/* Emulation of nl_langinfo. Used in fns.c:Flocale_info. */
-char *nl_langinfo (nl_item item)
+char *
+nl_langinfo (nl_item item)
{
/* Conversion of Posix item numbers to their Windows equivalents. */
static const LCTYPE w32item[] = {
return make_number (GetThreadLocale ());
}
-DWORD int_from_hex (char * s)
+DWORD
+int_from_hex (char * s)
{
DWORD val = 0;
static char hex[] = "0123456789abcdefABCDEF";
char * p;
- while (*s && (p = strchr(hex, *s)) != NULL)
+ while (*s && (p = strchr (hex, *s)) != NULL)
{
unsigned digit = p - hex;
if (digit > 15)
function isn't given a context pointer. */
Lisp_Object Vw32_valid_locale_ids;
-BOOL CALLBACK enum_locale_fn (LPTSTR localeNum)
+BOOL CALLBACK
+enum_locale_fn (LPTSTR localeNum)
{
DWORD id = int_from_hex (localeNum);
Vw32_valid_locale_ids = Fcons (make_number (id), Vw32_valid_locale_ids);
function isn't given a context pointer. */
Lisp_Object Vw32_valid_codepages;
-BOOL CALLBACK enum_codepage_fn (LPTSTR codepageNum)
+BOOL CALLBACK
+enum_codepage_fn (LPTSTR codepageNum)
{
DWORD id = atoi (codepageNum);
Vw32_valid_codepages = Fcons (make_number (id), Vw32_valid_codepages);
}
\f
+void
syms_of_ntproc ()
{
DEFSYM (Qhigh, "high");
DEFVAR_LISP ("w32-get-true-file-attributes", &Vw32_get_true_file_attributes,
doc: /* Non-nil means determine accurate file attributes in `file-attributes'.
This option controls whether to issue additional system calls to determine
-accurate link counts, file type, and ownership information. It is only
+accurate link counts, file type, and ownership information. It is more
useful for files on NTFS volumes, where hard links and file security are
-supported.
+supported, than on volumes of the FAT family.
Without these system calls, link count will always be reported as 1 and file
ownership will be attributed to the current user.