Sync with r21-2-35.
[chise/xemacs-chise.git] / src / process.c
index f5e5dae..028cfb4 100644 (file)
@@ -107,6 +107,7 @@ struct hash_table *usid_to_process;
 Lisp_Object Vprocess_list;
 
 extern Lisp_Object Vlisp_EXEC_SUFFIXES;
+Lisp_Object Vnull_device;
 
 \f
 
@@ -1073,24 +1074,25 @@ See `set-process-filter' for more info on filter functions.
   return XPROCESS (proc)->filter;
 }
 
-DEFUN ("process-send-region", Fprocess_send_region, 3, 3, 0, /*
-Send current contents of region as input to PROCESS.
+DEFUN ("process-send-region", Fprocess_send_region, 3, 4, 0, /*
+Send current contents of the region between START and END as input to PROCESS.
 PROCESS may be a process name or an actual process.
-Called from program, takes three arguments, PROCESS, START and END.
+BUFFER specifies the buffer to look in; if nil, the current buffer is used.
 If the region is more than 500 or so characters long,
 it is sent in several bunches.  This may happen even for shorter regions.
 Output from processes can arrive in between bunches.
 */
-       (process, start, end))
+       (process, start, end, buffer))
 {
   /* This function can GC */
   Lisp_Object proc = get_process (process);
   Bufpos st, en;
+  struct buffer *buf = decode_buffer (buffer, 0);
 
-  get_buffer_range_char (current_buffer, start, end, &st, &en, 0);
+  XSETBUFFER (buffer, buf);
+  get_buffer_range_char (buf, start, end, &st, &en, 0);
 
-  send_process (proc, Fcurrent_buffer (), 0,
-                st, en - st);
+  send_process (proc, buffer, 0, st, en - st);
   return Qnil;
 }
 
@@ -2074,6 +2076,22 @@ nil means don't delete them until `list-processes' is run.
 
   delete_exited_processes = 1;
 
+  DEFVAR_CONST_LISP ("null-device", &Vnull_device /*
+Name of the null device, which differs from system to system.
+The null device is a filename that acts as a sink for arbitrary amounts of
+data, which is discarded, or as a source for a zero-length file.
+It is available on all the systems that we currently support, but with
+different names (typically either `/dev/null' or `nul').
+
+Note that there is also a /dev/zero on most modern Unix versions (including
+Cygwin), which acts like /dev/null when used as a sink, but as a source
+it sends a non-ending stream of zero bytes.  It's used most often along
+with memory-mapping.  We don't provide a Lisp variable for this because
+the operations needing this are lower level than what ELisp programs
+typically do, and in any case no equivalent exists under native MS Windows.
+*/ );
+  Vnull_device = build_string (NULL_DEVICE);
+
   DEFVAR_LISP ("process-connection-type", &Vprocess_connection_type /*
 Control type of device used to communicate with subprocesses.
 Values are nil to use a pipe, or t or `pty' to use a pty.