#include "syswait.h"
-extern char *get_operating_system_release ();
+extern char *get_operating_system_release (void);
/* Serial processes require termios or Windows. */
#if defined (HAVE_TERMIOS) || defined (WINDOWSNT)
static SELECT_TYPE input_wait_mask;
+/* Non-zero if keyboard input is on hold, zero otherwise. */
+
+static int kbd_is_on_hold;
+
/* Mask that excludes keyboard input descriptor(s). */
static SELECT_TYPE non_keyboard_wait_mask;
register unsigned char *cp = NULL;
register int i;
- bzero (sa, len);
+ memset (sa, 0, len);
if (VECTORP (address))
{
/* This is broken, at least in the Linux 2.4 kernel.
To unbind, the arg must be a zero integer, not the empty string.
This should work on all systems. KFS. 2003-09-23. */
- bzero (devname, sizeof devname);
+ memset (devname, 0, sizeof devname);
if (STRINGP (val))
{
char *arg = (char *) SDATA (val);
int len = min (strlen (arg), IFNAMSIZ);
- bcopy (arg, devname, len);
+ memcpy (devname, arg, len);
}
else if (!NILP (val))
error ("Bad option value for %s", name);
p->inherit_coding_system_flag
= !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
- Fserial_process_configure(nargs, args);
+ Fserial_process_configure (nargs, args);
specpdl_ptr = specpdl + specpdl_count;
host = Qnil;
}
CHECK_STRING (service);
- bzero (&address_un, sizeof address_un);
+ memset (&address_un, 0, sizeof address_un);
address_un.sun_family = AF_LOCAL;
strncpy (address_un.sun_path, SDATA (service), sizeof address_un.sun_path);
ai.ai_addr = (struct sockaddr *) &address_un;
ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
if (ret)
#ifdef HAVE_GAI_STRERROR
- error ("%s/%s %s", SDATA (host), portstring, gai_strerror(ret));
+ error ("%s/%s %s", SDATA (host), portstring, gai_strerror (ret));
#else
error ("%s/%s getaddrinfo error %d", SDATA (host), portstring, ret);
#endif
port = svc_info->s_port;
}
- bzero (&address_in, sizeof address_in);
+ memset (&address_in, 0, sizeof address_in);
address_in.sin_family = family;
address_in.sin_addr.s_addr = INADDR_ANY;
address_in.sin_port = port;
if (host_info_ptr)
{
- bcopy (host_info_ptr->h_addr, (char *) &address_in.sin_addr,
- host_info_ptr->h_length);
+ memcpy (&address_in.sin_addr, host_info_ptr->h_addr,
+ host_info_ptr->h_length);
family = host_info_ptr->h_addrtype;
address_in.sin_family = family;
}
if (numeric_addr == -1)
error ("Unknown host \"%s\"", SDATA (host));
- bcopy ((char *)&numeric_addr, (char *) &address_in.sin_addr,
- sizeof (address_in.sin_addr));
+ memcpy (&address_in.sin_addr, &numeric_addr,
+ sizeof (address_in.sin_addr));
}
}
if (is_server)
{
Lisp_Object remote;
- bzero (datagram_address[s].sa, lres->ai_addrlen);
+ memset (datagram_address[s].sa, 0, lres->ai_addrlen);
if (remote = Fplist_get (contact, QCremote), !NILP (remote))
{
int rfamily, rlen;
}
}
else
- bcopy (lres->ai_addr, datagram_address[s].sa, lres->ai_addrlen);
+ memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen);
}
#endif
contact = Fplist_put (contact, QCaddress,
again:
ifaces += 25;
- buf_size = ifaces * sizeof(ifreqs[0]);
+ buf_size = ifaces * sizeof (ifreqs[0]);
ifreqs = (struct ifreq *)xrealloc(ifreqs, buf_size);
if (!ifreqs)
{
char namebuf[sizeof (ifq->ifr_name) + 1];
if (ifq->ifr_addr.sa_family != AF_INET)
continue;
- bcopy (ifq->ifr_name, namebuf, sizeof (ifq->ifr_name));
+ memcpy (namebuf, ifq->ifr_name, sizeof (ifq->ifr_name));
namebuf[sizeof (ifq->ifr_name)] = 0;
res = Fcons (Fcons (build_string (namebuf),
conv_sockaddr_to_lisp (&ifq->ifr_addr,
CHECK_STRING (ifname);
- bzero (rq.ifr_name, sizeof rq.ifr_name);
+ memset (rq.ifr_name, 0, sizeof rq.ifr_name);
strncpy (rq.ifr_name, SDATA (ifname), sizeof (rq.ifr_name));
s = socket (AF_INET, SOCK_STREAM, 0);
int i;
args[0] = build_string ("%x:%x:%x:%x:%x:%x:%x:%x");
for (i = 0; i < 8; i++)
- args[i+1] = make_number (ntohs(ip6[i]));
+ args[i+1] = make_number (ntohs (ip6[i]));
host = Fformat (9, args);
service = make_number (ntohs (saddr.in.sin_port));
SELECT_TYPE Ctemp;
#endif
- Atemp = input_wait_mask;
+ if (kbd_on_hold_p ())
+ FD_ZERO (&Atemp);
+ else
+ Atemp = input_wait_mask;
IF_NON_BLOCKING_CONNECT (Ctemp = connect_wait_mask);
EMACS_SET_SECS_USECS (timeout, 0, 0);
/* getsockopt(,,SO_ERROR,,) is said to hang on some systems.
So only use it on systems where it is known to work. */
{
- int xlen = sizeof(xerrno);
- if (getsockopt(channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
+ int xlen = sizeof (xerrno);
+ if (getsockopt (channel, SOL_SOCKET, SO_ERROR, &xerrno, &xlen))
xerrno = errno;
}
#else
{
struct sockaddr pname;
- int pnamelen = sizeof(pname);
+ int pnamelen = sizeof (pname);
/* If connection failed, getpeername will fail. */
xerrno = 0;
- if (getpeername(channel, &pname, &pnamelen) < 0)
+ if (getpeername (channel, &pname, &pnamelen) < 0)
{
/* Obtain connect failure code through error slippage. */
char dummy;
xerrno = errno;
- if (errno == ENOTCONN && read(channel, &dummy, 1) < 0)
+ if (errno == ENOTCONN && read (channel, &dummy, 1) < 0)
xerrno = errno;
}
}
chars = (char *) alloca (carryover + readmax);
if (carryover)
/* See the comment above. */
- bcopy (SDATA (p->decoding_buf), chars, carryover);
+ memcpy (chars, SDATA (p->decoding_buf), carryover);
#ifdef DATAGRAM_SOCKETS
/* We have a working select, so proc_buffered_char is always -1. */
{
if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
p->decoding_buf = make_uninit_string (coding->carryover_bytes);
- bcopy (coding->carryover, SDATA (p->decoding_buf),
- coding->carryover_bytes);
+ memcpy (SDATA (p->decoding_buf), coding->carryover,
+ coding->carryover_bytes);
p->decoding_carryover = coding->carryover_bytes;
}
if (SBYTES (text) > 0)
{
if (SCHARS (p->decoding_buf) < coding->carryover_bytes)
p->decoding_buf = make_uninit_string (coding->carryover_bytes);
- bcopy (coding->carryover, SDATA (p->decoding_buf),
- coding->carryover_bytes);
+ memcpy (SDATA (p->decoding_buf), coding->carryover,
+ coding->carryover_bytes);
p->decoding_carryover = coding->carryover_bytes;
}
/* Adjust the multibyteness of TEXT to that of the buffer. */
int rv;
struct coding_system *coding;
struct gcpro gcpro1;
- SIGTYPE (*volatile old_sigpipe) ();
+ SIGTYPE (*volatile old_sigpipe) (int);
GCPRO1 (object);
while (this > 0)
{
int outfd = p->outfd;
- old_sigpipe = (SIGTYPE (*) ()) signal (SIGPIPE, send_process_trap);
+ old_sigpipe = (SIGTYPE (*) (int)) signal (SIGPIPE, send_process_trap);
#ifdef DATAGRAM_SOCKETS
if (DATAGRAM_CHAN_P (outfd))
{
CHECK_SYMBOL (sigcode);
name = SDATA (SYMBOL_NAME (sigcode));
- if (!strncmp(name, "SIG", 3) || !strncmp(name, "sig", 3))
+ if (!strncmp (name, "SIG", 3) || !strncmp (name, "sig", 3))
name += 3;
if (0)
if (!proc_encode_coding_system[new_outfd])
proc_encode_coding_system[new_outfd]
= (struct coding_system *) xmalloc (sizeof (struct coding_system));
- bcopy (proc_encode_coding_system[old_outfd],
- proc_encode_coding_system[new_outfd],
- sizeof (struct coding_system));
- bzero (proc_encode_coding_system[old_outfd],
- sizeof (struct coding_system));
+ memcpy (proc_encode_coding_system[new_outfd],
+ proc_encode_coding_system[old_outfd],
+ sizeof (struct coding_system));
+ memset (proc_encode_coding_system[old_outfd], 0,
+ sizeof (struct coding_system));
XPROCESS (proc)->outfd = new_outfd;
}
\f
+/* Stop reading input from keyboard sources. */
+
+void
+hold_keyboard_input (void)
+{
+ kbd_is_on_hold = 1;
+}
+
+/* Resume reading input from keyboard sources. */
+
+void
+unhold_keyboard_input (void)
+{
+ kbd_is_on_hold = 0;
+}
+
+/* Return non-zero if keyboard input is on hold, zero otherwise. */
+
+int
+kbd_on_hold_p (void)
+{
+ return kbd_is_on_hold;
+}
+
/* Add DESC to the set of keyboard input descriptors. */
void
chan_process[i] = Qnil;
proc_buffered_char[i] = -1;
}
- bzero (proc_decode_coding_system, sizeof proc_decode_coding_system);
- bzero (proc_encode_coding_system, sizeof proc_encode_coding_system);
+ memset (proc_decode_coding_system, 0, sizeof proc_decode_coding_system);
+ memset (proc_encode_coding_system, 0, sizeof proc_encode_coding_system);
#ifdef DATAGRAM_SOCKETS
- bzero (datagram_address, sizeof datagram_address);
+ memset (datagram_address, 0, sizeof datagram_address);
#endif
#ifdef HAVE_SOCKETS
processes. As such, we only change the default value. */
if (initialized)
{
- char *release = get_operating_system_release();
+ char *release = get_operating_system_release ();
if (!release || !release[0] || (release[0] < MIN_PTY_KERNEL_VERSION
&& release[1] == '.')) {
Vprocess_connection_type = Qnil;
void
init_process ()
{
+ kbd_is_on_hold = 0;
}
void