/* Utility and Unix shadow routines for GNU Emacs on the Microsoft W32 API.
Copyright (C) 1994, 1995, 2000, 2001, 2002, 2003, 2004,
- 2005, 2006 Free Software Foundation, Inc.
+ 2005, 2006, 2007 Free Software Foundation, Inc.
This file is part of GNU Emacs.
#include <sys/file.h>
#include <sys/time.h>
#include <sys/utime.h>
+#include <mbstring.h> /* for _mbspbrk */
/* must include CRT headers *before* config.h */
PSID pSid);
/* ** A utility function ** */
-static BOOL is_windows_9x ()
+static BOOL
+is_windows_9x ()
{
static BOOL s_b_ret=0;
OSVERSIONINFO os_ver;
int len = 0;
/* must be valid filename, no wild cards or other invalid characters */
- if (strpbrk (name, "*?|<>\""))
+ if (_mbspbrk (name, "*?|<>\""))
return 0;
dir_handle = FindFirstFile (name, &find_data);
if (!IS_DIRECTORY_SEP (ptr[0]) || !IS_DIRECTORY_SEP (ptr[1]) || !ptr[2])
return 0;
- if (strpbrk (ptr + 2, "*?|<>\"\\/"))
+ if (_mbspbrk (ptr + 2, "*?|<>\"\\/"))
return 0;
return 1;
}
name = (char *) map_w32_filename (path, &path);
- /* must be valid filename, no wild cards or other invalid characters */
- if (strpbrk (name, "*?|<>\""))
+ /* Must be valid filename, no wild cards or other invalid
+ characters. We use _mbspbrk to support multibyte strings that
+ might look to strpbrk as if they included literal *, ?, and other
+ characters mentioned below that are disallowed by Windows
+ filesystems. */
+ if (_mbspbrk (name, "*?|<>\""))
{
errno = ENOENT;
return -1;
/* function to set h_errno for compatability; map winsock error codes to
normal system codes where they overlap (non-overlapping definitions
are already in <sys/socket.h> */
-static void set_errno ()
+static void
+set_errno ()
{
if (winsock_lib == NULL)
h_errno = EINVAL;
errno = h_errno;
}
-static void check_errno ()
+static void
+check_errno ()
{
if (h_errno == 0 && winsock_lib != NULL)
pfn_WSASetLastError (0);
return cp->status;
}
-int _sys_wait_accept (int fd)
+int
+_sys_wait_accept (int fd)
{
HANDLE hEv;
child_process * cp;
{
rc = WaitForSingleObject (hEv, INFINITE);
pfn_WSAEventSelect (SOCK_HANDLE (fd), NULL, 0);
- pfn_WSACloseEvent (hEv);
if (rc == WAIT_OBJECT_0)
cp->status = STATUS_READ_SUCCEEDED;
}
+ pfn_WSACloseEvent (hEv);
return cp->status;
}
shut_down_emacs (0, 0, Qnil);
}
- /* Allow other handlers to handle this signal. */
+ /* Allow other handlers to handle this signal. */
return FALSE;
}
must always be initialized on startup even when the global variable
initialized is non zero (see the function main in emacs.c).
*/
-void globals_of_w32 ()
+void
+globals_of_w32 ()
{
g_b_init_is_windows_9x = 0;
g_b_init_open_process_token = 0;