#include "lisp.h"
#include <pwd.h>
+#include <grp.h>
#ifdef __GNUC__
#define _ANONYMOUS_UNION
extern Lisp_Object Vw32_downcase_file_names;
extern Lisp_Object Vw32_generate_fake_inodes;
extern Lisp_Object Vw32_get_true_file_attributes;
-extern Lisp_Object Vw32_num_mouse_buttons;
+extern int w32_num_mouse_buttons;
\f
/*
the_passwd_shell,
};
+static struct group the_group =
+{
+ /* There are no groups on NT, so we just return "root" as the
+ group name. */
+ "root",
+};
+
int
getuid ()
{
return NULL;
}
+struct group *
+getgrgid (gid_t gid)
+{
+ return &the_group;
+}
+
struct passwd *
getpwnam (char *name)
{
_snprintf (buf, sizeof(buf)-1, "emacs_dir=%s", modname);
_putenv (strdup (buf));
}
+ /* Handle running emacs from the build directory: src/oo-spd/i386/ */
+
+ /* FIXME: should use substring of get_emacs_configuration ().
+ But I don't think the Windows build supports alpha, mips etc
+ anymore, so have taken the easy option for now. */
+ else if (p && stricmp (p, "\\i386") == 0)
+ {
+ *p = 0;
+ p = strrchr (modname, '\\');
+ if (p != NULL)
+ {
+ *p = 0;
+ p = strrchr (modname, '\\');
+ if (p && stricmp (p, "\\src") == 0)
+ {
+ char buf[SET_ENV_BUF_SIZE];
+
+ *p = 0;
+ for (p = modname; *p; p++)
+ if (*p == '\\') *p = '/';
+
+ _snprintf (buf, sizeof(buf)-1, "emacs_dir=%s", modname);
+ _putenv (strdup (buf));
+ }
+ }
+ }
}
for (i = 0; i < (sizeof (env_vars) / sizeof (env_vars[0])); i++)
/* Determine if there is a middle mouse button, to allow parse_button
to decide whether right mouse events should be mouse-2 or
mouse-3. */
- XSETINT (Vw32_num_mouse_buttons, GetSystemMetrics (SM_CMOUSEBUTTONS));
+ w32_num_mouse_buttons = GetSystemMetrics (SM_CMOUSEBUTTONS);
init_user_info ();
}
/* Support shares on a network resource as subdirectories of a read-only
root directory. */
static HANDLE wnet_enum_handle = INVALID_HANDLE_VALUE;
-HANDLE open_unc_volume (char *);
+HANDLE open_unc_volume (const char *);
char *read_unc_volume (HANDLE, char *, int);
void close_unc_volume (HANDLE);
}
HANDLE
-open_unc_volume (char *path)
+open_unc_volume (const char *path)
{
NETRESOURCE nr;
HANDLE henum;
}
DWORD
-unc_volume_file_attributes (char *path)
+unc_volume_file_attributes (const char *path)
{
HANDLE henum;
DWORD attrs;
if (rc == 0)
{
- flags = FILE_PIPE | FILE_READ | FILE_BINARY;
- fd_info[phandles[0]].flags = flags;
+ /* Protect against overflow, since Windows can open more handles than
+ our fd_info array has room for. */
+ if (phandles[0] >= MAXDESC || phandles[1] >= MAXDESC)
+ {
+ _close (phandles[0]);
+ _close (phandles[1]);
+ rc = -1;
+ }
+ else
+ {
+ flags = FILE_PIPE | FILE_READ | FILE_BINARY;
+ fd_info[phandles[0]].flags = flags;
- flags = FILE_PIPE | FILE_WRITE | FILE_BINARY;
- fd_info[phandles[1]].flags = flags;
+ flags = FILE_PIPE | FILE_WRITE | FILE_BINARY;
+ fd_info[phandles[1]].flags = flags;
+ }
}
return rc;
}
/* From ntproc.c */
-extern Lisp_Object Vw32_pipe_read_delay;
+extern int w32_pipe_read_delay;
/* Function to do blocking read of one byte, needed to implement
select. It is only allowed on sockets and pipes. */
shell on NT is very slow if we don't do this. */
if (rc > 0)
{
- int wait = XINT (Vw32_pipe_read_delay);
+ int wait = w32_pipe_read_delay;
if (wait > 0)
Sleep (wait);
}
/* end of nt.c */
+
+/* arch-tag: 90442dd3-37be-482b-b272-ac752e3049f1
+ (do not change this comment) */