GNU Emacs is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
+the Free Software Foundation; either version 3, or (at your option)
any later version.
GNU Emacs is distributed in the hope that it will be useful,
#include <sys/wait.h>
#endif
+#ifdef HAVE_RES_INIT
+#include <netinet/in.h>
+#include <arpa/nameser.h>
+#include <resolv.h>
+#endif
+
#include "lisp.h"
#include "systime.h"
#include "systty.h"
#include "charset.h"
#include "coding.h"
#include "process.h"
+#include "frame.h"
#include "termhooks.h"
#include "termopts.h"
#include "commands.h"
#include "keyboard.h"
-#include "frame.h"
#include "blockinput.h"
#include "dispextern.h"
#include "composite.h"
p->tick = 0;
p->update_tick = 0;
p->pid = 0;
+ p->pty_flag = 0;
p->raw_status_new = 0;
p->status = Qrun;
p->mark = Fmake_marker ();
buf = Fget_buffer (buffer);
if (NILP (buf)) return Qnil;
- for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail))
+ for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
{
- proc = Fcdr (Fcar (tail));
+ proc = Fcdr (XCAR (tail));
if (PROCESSP (proc) && EQ (XPROCESS (proc)->buffer, buf))
return proc;
}
DEFUN ("set-process-filter", Fset_process_filter, Sset_process_filter,
2, 2, 0,
doc: /* Give PROCESS the filter function FILTER; nil means no filter.
-t means stop accepting output from the process.
+A value of t means stop accepting output from the process.
When a process has a filter, its buffer is not used for output.
Instead, each time it does output, the entire string of output is
w_buffer = 6; /* Buffer */
w_tty = 0; /* Omit if no ttys */
- for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail))
+ for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
{
int i;
- proc = Fcdr (Fcar (tail));
+ proc = Fcdr (XCAR (tail));
p = XPROCESS (proc);
if (NILP (p->childp))
continue;
if (w_tty)
{
XSETFASTINT (i_tty, XFASTINT (i_buffer) + w_buffer + 1);
- XSETFASTINT (i_command, XFASTINT (i_buffer) + w_tty + 1);
- } else {
+ XSETFASTINT (i_command, XFASTINT (i_tty) + w_tty + 1);
+ }
+ else
+ {
i_tty = Qnil;
XSETFASTINT (i_command, XFASTINT (i_buffer) + w_buffer + 1);
}
Findent_to (i_command, minspace); write_string ("-------", -1);
write_string ("\n", -1);
- for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail))
+ for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object symbol;
- proc = Fcdr (Fcar (tail));
+ proc = Fcdr (XCAR (tail));
p = XPROCESS (proc);
if (NILP (p->childp))
continue;
XPROCESS (proc)->encoding_buf = make_uninit_string (0);
XPROCESS (proc)->inherit_coding_system_flag
- = (NILP (buffer) || !inherit_process_coding_system);
+ = !(NILP (buffer) || !inherit_process_coding_system);
create_process (proc, (char **) new_argv, current_dir);
\f
/* A version of request_sigio suitable for a record_unwind_protect. */
+#ifdef __ultrix__
static Lisp_Object
unwind_request_sigio (dummy)
Lisp_Object dummy;
request_sigio ();
return Qnil;
}
+#endif
/* Create a network stream/datagram client/server process. Treated
exactly like a normal process when reading and writing. Primary
:service SERVICE -- SERVICE is name of the service desired, or an
integer specifying a port number to connect to. If SERVICE is t,
-a random port number is selected for the server.
+a random port number is selected for the server. (If Emacs was
+compiled with getaddrinfo, a port number can also be specified as a
+string, e.g. "80", as well as an integer. This is not portable.)
:type TYPE -- TYPE is the type of connection. The default (nil) is a
stream type connection, `datagram' creates a datagram type connection.
:filter-multibyte BOOL -- If BOOL is non-nil, strings given to the
process filter are multibyte, otherwise they are unibyte.
-If this keyword is not specified, the strings are multibyte iff
+If this keyword is not specified, the strings are multibyte if
`default-enable-multibyte-characters' is non-nil.
:sentinel SENTINEL -- Install SENTINEL as the process sentinel.
hints.ai_family = family;
hints.ai_socktype = socktype;
hints.ai_protocol = 0;
+
+#ifdef HAVE_RES_INIT
+ res_init ();
+#endif
+
ret = getaddrinfo (SDATA (host), portstring, &hints, &res);
if (ret)
#ifdef HAVE_GAI_STRERROR
as it may `hang' Emacs for a very long time. */
immediate_quit = 1;
QUIT;
+
+#ifdef HAVE_RES_INIT
+ res_init ();
+#endif
+
host_info_ptr = gethostbyname (SDATA (host));
immediate_quit = 0;
open_socket:
+#ifdef __ultrix__
+ /* Previously this was compiled unconditionally, but that seems
+ unnecessary on modern systems, and `unrequest_sigio' was a noop
+ under X anyway. --lorentey */
/* Kernel bugs (on Ultrix at least) cause lossage (not just EINTR)
when connect is interrupted. So let's not let it get interrupted.
Note we do not turn off polling, because polling is only used
record_unwind_protect (unwind_request_sigio, Qnil);
unrequest_sigio ();
}
+#endif
/* Do this in case we never enter the for-loop below. */
count1 = SPECPDL_INDEX ();
p->encoding_buf = make_uninit_string (0);
p->inherit_coding_system_flag
- = (!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
+ = !(!NILP (tem) || NILP (buffer) || !inherit_process_coding_system);
UNGCPRO;
return proc;
If optional fourth arg JUST-THIS-ONE is non-nil, only accept output
from PROCESS, suspending reading output from other processes.
If JUST-THIS-ONE is an integer, don't run any timers either.
-Return non-nil iff we received any output before the timeout expired. */)
+Return non-nil if we received any output before the timeout expired. */)
(process, seconds, millisec, just_this_one)
register Lisp_Object process, seconds, millisec, just_this_one;
{
(and gobble terminal input into the buffer if any arrives).
If WAIT_PROC is specified, wait until something arrives from that
- process. The return value is true iff we read some input from
+ process. The return value is true if we read some input from
that process.
If JUST_WAIT_PROC is non-nil, handle only output from WAIT_PROC
(suspending output from other processes). A negative value
means don't run any timers either.
- If WAIT_PROC is specified, then the function returns true iff we
+ If WAIT_PROC is specified, then the function returns true if we
received input from that process before the timeout elapsed.
- Otherwise, return true iff we received input from any process. */
+ Otherwise, return true if we received input from any process. */
int
wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
carryover);
p->decoding_carryover = carryover;
/* Adjust the multibyteness of TEXT to that of the filter. */
- if (p->filter_multibyte != STRING_MULTIBYTE (text))
+ if (!p->filter_multibyte != !STRING_MULTIBYTE (text))
text = (STRING_MULTIBYTE (text)
? Fstring_as_unibyte (text)
: Fstring_to_multibyte (text));
that we run, we get called again to handle their status changes. */
update_tick = process_tick;
- for (tail = Vprocess_alist; !NILP (tail); tail = Fcdr (tail))
+ for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail))
{
Lisp_Object symbol;
register struct Lisp_Process *p;
- proc = Fcdr (Fcar (tail));
+ proc = Fcdr (XCAR (tail));
p = XPROCESS (proc);
if (p->tick != p->update_tick)
\f
-/* The first time this is called, assume keyboard input comes from DESC
- instead of from where we used to expect it.
- Subsequent calls mean assume input keyboard can come from DESC
- in addition to other places. */
-
-static int add_keyboard_wait_descriptor_called_flag;
+/* Add DESC to the set of keyboard input descriptors. */
void
add_keyboard_wait_descriptor (desc)
int desc;
{
- if (! add_keyboard_wait_descriptor_called_flag)
- FD_CLR (0, &input_wait_mask);
- add_keyboard_wait_descriptor_called_flag = 1;
FD_SET (desc, &input_wait_mask);
FD_SET (desc, &non_process_wait_mask);
if (desc > max_keyboard_desc)
process_output_skip = 0;
#endif
+ /* Don't do this, it caused infinite select loops. The display
+ method should call add_keyboard_wait_descriptor on stdin if it
+ needs that. */
+#if 0
FD_SET (0, &input_wait_mask);
+#endif
Vprocess_alist = Qnil;
#ifdef SIGCHLD
do_display != 0 means redisplay should be done to show subprocess
output that arrives.
- Return true iff we received input from any process. */
+ Return true if we received input from any process. */
int
wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,