diff lisp/process.el @ 853:2b6fa2618f76

[xemacs-hg @ 2002-05-28 08:44:22 by ben] merge my stderr-proc ws make-docfile.c: Fix places where we forget to check for EOF. code-init.el: Don't use CRLF conversion by default on process output. CMD.EXE and friends work both ways but Cygwin programs don't like the CRs. code-process.el, multicast.el, process.el: Removed. Improvements to call-process-internal: -- allows a buffer to be specified for input and stderr output -- use it on all systems -- implement C-g as documented -- clean up and comment call-process-region uses new call-process facilities; no temp file. remove duplicate funs in process.el. comment exactly how coding systems work and fix various problems. open-multicast-group now does similar coding-system frobbing to open-network-stream. dumped-lisp.el, faces.el, msw-faces.el: Fix some hidden errors due to code not being defined at the right time. xemacs.mak: Add -DSTRICT. ================================================================ ALLOW SEPARATION OF STDOUT AND STDERR IN PROCESSES ================================================================ Standard output and standard error can be processed separately in a process. Each can have its own buffer, its own mark in that buffer, and its filter function. You can specify a separate buffer for stderr in `start-process' to get things started, or use the new primitives: set-process-stderr-buffer process-stderr-buffer process-stderr-mark set-process-stderr-filter process-stderr-filter Also, process-send-region takes a 4th optional arg, a buffer. Currently always uses a pipe() under Unix to read the error output. (#### Would a PTY be better?) sysdep.h, sysproc.h, unexfreebsd.c, unexsunos4.c, nt.c, emacs.c, callproc.c, symsinit.h, sysdep.c, Makefile.in.in, process-unix.c: Delete callproc.c. Move child_setup() to process-unix.c. wait_for_termination() now only needed on a few really old systems. console-msw.h, event-Xt.c, event-msw.c, event-stream.c, event-tty.c, event-unixoid.c, events.h, process-nt.c, process-unix.c, process.c, process.h, procimpl.h: Rewrite the process methods to handle a separate channel for error input. Create Lstreams for reading in the error channel. Many process methods need change. In general the changes are fairly clear as they involve duplicating what's used for reading the normal stdout and changing for stderr -- although tedious, as such changes are required throughout the entire process code. Rewrote the code that reads process output to do two loops, one for stdout and one for stderr. gpmevent.c, tooltalk.c: set_process_filter takes an argument for stderr. ================================================================ NEW ERROR-TRAPPING MECHANISM ================================================================ Totally rewrite error trapping code to be unified and support more features. Basic function is call_trapping_problems(), which lets you specify, by means of flags, what sorts of problems you want trapped. these can include -- quit -- errors -- throws past the function -- creation of "display objects" (e.g. buffers) -- deletion of already-existing "display objects" (e.g. buffers) -- modification of already-existing buffers -- entering the debugger -- gc -- errors->warnings (ala suspended errors) etc. All other error funs rewritten in terms of this one. Various older mechanisms removed or rewritten. window.c, insdel.c, console.c, buffer.c, device.c, frame.c: When creating a display object, added call to note_object_created(), for use with trapping_problems mechanism. When deleting, call check_allowed_operation() and note_object deleted(). The trapping-problems code records the objects created since the call-trapping-problems began. Those objects can be deleted, but none others (i.e. previously existing ones). bytecode.c, cmdloop.c: internal_catch takes another arg. eval.c: Add long comments describing the "five lists" used to maintain state (backtrace, gcpro, specbind, etc.) in the Lisp engine. backtrace.h, eval.c: Implement trapping-problems mechanism, eliminate old mechanisms or redo in terms of new one. frame.c, gutter.c: Flush out the concept of "critical display section", defined by the in_display() var. Use an internal_bind() to get it reset, rather than just doing it at end, because there may be a non-local exit. event-msw.c, event-stream.c, console-msw.h, device.c, dialog-msw.c, frame.c, frame.h, intl.c, toolbar.c, menubar-msw.c, redisplay.c, alloc.c, menubar-x.c: Make use of new trapping-errors stuff and rewrite code based on old mechanisms. glyphs-widget.c, redisplay.h: Protect calling Lisp in redisplay. insdel.c: Protect hooks against deleting existing buffers. frame-msw.c: Use EQ, not EQUAL in hash tables whose keys are just numbers. Otherwise we run into stickiness in redisplay because internal_equal() can QUIT. ================================================================ SIGNAL, C-G CHANGES ================================================================ Here we change the way that C-g interacts with event reading. The idea is that a C-g occurring while we're reading a user event should be read as C-g, but elsewhere should be a QUIT. The former code did all sorts of bizarreness -- requiring that no QUIT occurs anywhere in event-reading code (impossible to enforce given the stuff called or Lisp code invoked), and having some weird system involving enqueue/dequeue of a C-g and interaction with Vquit_flag -- and it didn't work. Now, we simply enclose all code where we want C-g read as an event with {begin/end}_dont_check_for_quit(). This completely turns off the mechanism that checks (and may remove or alter) C-g in the read-ahead queues, so we just get the C-g normal. Signal.c documents this very carefully. cmdloop.c: Correct use of dont_check_for_quit to new scheme, remove old out-of-date comments. event-stream.c: Fix C-g handling to actually work. device-x.c: Disable quit checking when err out. signal.c: Cleanup. Add large descriptive comment. process-unix.c, process-nt.c, sysdep.c: Use QUIT instead of REALLY_QUIT. It's not necessary to use REALLY_QUIT and just confuses the issue. lisp.h: Comment quit handlers. ================================================================ CONS CHANGES ================================================================ free_cons() now takes a Lisp_Object not the result of XCONS(). car and cdr have been renamed so that they don't get used directly; go through XCAR(), XCDR() instead. alloc.c, dired.c, editfns.c, emodules.c, fns.c, glyphs-msw.c, glyphs-x.c, glyphs.c, keymap.c, minibuf.c, search.c, eval.c, lread.c, lisp.h: Correct free_cons calling convention: now takes Lisp_Object, not Lisp_Cons chartab.c: Eliminate direct use of ->car, ->cdr, should be black box. callint.c: Rewrote using EXTERNAL_LIST_LOOP to avoid use of Lisp_Cons. ================================================================ USE INTERNAL-BIND-* ================================================================ eval.c: Cleanups of these funs. alloc.c, fileio.c, undo.c, specifier.c, text.c, profile.c, lread.c, redisplay.c, menubar-x.c, macros.c: Rewrote to use internal_bind_int() and internal_bind_lisp_object() in place of whatever varied and cumbersome mechanisms were formerly there. ================================================================ SPECBIND SANITY ================================================================ backtrace.h: - Improved comments backtrace.h, bytecode.c, eval.c: Add new mechanism check_specbind_stack_sanity() for sanity checking code each time the catchlist or specbind stack change. Removed older prototype of same mechanism. ================================================================ MISC ================================================================ lisp.h, insdel.c, window.c, device.c, console.c, buffer.c: Fleshed out authorship. device-msw.c: Correct bad Unicode-ization. print.c: Be more careful when not initialized or in fatal error handling. search.c: Eliminate running_asynch_code, an FSF holdover. alloc.c: Added comments about gc-cons-threshold. dialog-x.c: Use begin_gc_forbidden() around code to build up a widget value tree, like in menubar-x.c. gui.c: Use Qunbound not Qnil as the default for gethash. lisp-disunion.h, lisp-union.h: Added warnings on use of VOID_TO_LISP(). lisp.h: Use ERROR_CHECK_STRUCTURES to turn on ERROR_CHECK_TRAPPING_PROBLEMS and ERROR_CHECK_TYPECHECK lisp.h: Add assert_with_message. lisp.h: Add macros for gcproing entire arrays. (You could do this before but it required manual twiddling the gcpro structure.) lisp.h: Add prototypes for new functions defined elsewhere.
author ben
date Tue, 28 May 2002 08:45:36 +0000
parents a634e3b7acc8
children 84762348c6f9
line wrap: on
line diff
--- a/lisp/process.el	Sat May 25 01:55:30 2002 +0000
+++ b/lisp/process.el	Tue May 28 08:45:36 2002 +0000
@@ -1,7 +1,7 @@
 ;;; process.el --- commands for subprocesses; split out of simple.el
 
 ;; Copyright (C) 1985-7, 1993,4, 1997 Free Software Foundation, Inc.
-;; Copyright (C) 1995, 2000, 2001 Ben Wing.
+;; Copyright (C) 1995, 2000, 2001, 2002 Ben Wing.
 
 ;; Author: Ben Wing
 ;; Maintainer: XEmacs Development Team
@@ -61,7 +61,6 @@
 
 (defun start-process-shell-command (name buffer &rest args)
   "Start a program in a subprocess.  Return the process object for it.
-Args are NAME BUFFER COMMAND &rest COMMAND-ARGS.
 NAME is name for process.  It is modified if necessary to make it unique.
 BUFFER is the buffer or (buffer-name) to associate with the process.
  Process output goes at end of that buffer, unless you specify
@@ -76,162 +75,216 @@
   (start-process name buffer shell-file-name shell-command-switch
 		 (mapconcat #'identity args " ")))
 
-(defun call-process-internal (program &optional infile buffer display &rest args)
-  "Call PROGRAM synchronously in separate process, with coding-system specified.
-Arguments are
- (PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS).
+(defun call-process-internal (program &optional infile buffer display
+				      &rest args)
+  "Internal function to call PROGRAM synchronously in separate process.
+Lisp callers should use `call-process' or `call-process-region'.
+
 The program's input comes from file INFILE (nil means `/dev/null').
+XEmacs feature: INFILE can also be a list of (BUFFER [START [END]]), i.e.
+a list of one to three elements, consisting of a buffer and optionally
+a start position or start and end position.  In this case, input comes
+from the buffer, starting from START (defaults to the beginning of the
+buffer) and ending at END (defaults to the end of the buffer).
+
 Insert output in BUFFER before point; t means current buffer;
  nil for BUFFER means discard it; 0 means discard and don't wait.
+If BUFFER is a string, then find or create a buffer with that name,
+then insert the output in that buffer, before point.
 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
 REAL-BUFFER says what to do with standard output, as above,
 while STDERR-FILE says what to do with standard error in the child.
 STDERR-FILE may be nil (discard standard error output),
-t (mix it with ordinary output), or a file name string.
+t (mix it with ordinary output), a file name string, or (XEmacs feature)
+a buffer object.  If STDERR-FILE is a buffer object (but not the name of
+a buffer, since that would be interpreted as a file), the standard error
+output will be inserted into the buffer before point.
 
 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.
 Remaining arguments are strings passed as command arguments to PROGRAM.
 
-If BUFFER is 0, `call-process' returns immediately with value nil.
-Otherwise it waits for PROGRAM to terminate and returns a numeric exit status
- or a signal description string.
-If you quit, the process is killed with SIGINT, or SIGKILL if you
- quit again."
-  ;; #### remove windows-nt check when this is ready for prime time.
-  (if (not (eq 'windows-nt system-type))
-      (apply 'old-call-process-internal program infile buffer display args)
-    (let (proc inbuf errbuf discard)
-      (unwind-protect
-	  (progn
-	    (when infile
-	      (setq infile (expand-file-name infile))
-	      (setq inbuf (generate-new-buffer "*call-process*"))
-	      (with-current-buffer inbuf
-               ;; Make sure this works with jka-compr
-               (let ((file-name-handler-alist nil))
-                 (insert-file-contents-internal infile nil nil nil nil
-                                                'binary))))
-	    (let ((stderr (if (consp buffer) (second buffer) t)))
-	      (if (consp buffer) (setq buffer (car buffer)))
-	      (setq buffer
-		    (cond ((null buffer) nil)
-			  ((eq buffer t) (current-buffer))
-			  ;; use integerp for compatibility with existing
-			  ;; call-process rmsism.
-			  ((integerp buffer) (setq discard t) nil)
-			  (t (get-buffer-create buffer))))
-	      (when (and stderr (not (eq t stderr)))
+If BUFFER is 0, returns immediately with value nil.
+Otherwise waits for PROGRAM to terminate and returns a numeric exit status
+or a signal description string.  If you quit, the process is first killed
+with SIGINT, then with SIGKILL if you quit again before the process exits.
+
+Coding systems for the process are the same as for `start-process-internal'."
+  (let (proc inbuf errbuf kill-inbuf kill-errbuf no-wait start end)
+    ;; first set up an unwind-protect to clean everything up.  this will:
+    ;;
+    ;; -- kill the process. (when we're not waiting for it to finish, we
+    ;;    set PROC to nil when we're ready to exit so this doesn't happen --
+    ;;    if we're interrupted before we're ready to exit, we should still
+    ;;    kill the process)
+    ;; -- kill temporary buffers created to handle I/O to or from a file.
+    ;;    KILL-INBUF/KILL-ERRBUF tell us if we should do so.
+    ;;
+    ;; note that we need to be *very* careful in this code to handle C-g
+    ;; at any point.
+    (unwind-protect
+	(progn
+	  ;; first handle INFILE.
+	  (cond ((stringp infile)
+		 (setq infile (expand-file-name infile))
+		 (setq kill-inbuf t)
+		 (setq inbuf (generate-new-buffer "*call-process*"))
+		 ;; transfer the exact contents of the file to the process.
+		 ;; we do that by reading in and writing out in
+		 ;; binary. #### is this even correct?  should we be doing
+		 ;; the same thing with stderr?  if so we'd need a way of
+		 ;; controlling the stderr coding system separate from
+		 ;; everything else.
+		 (with-current-buffer inbuf
+		   ;; Make sure this works with jka-compr
+		   (let ((file-name-handler-alist nil))
+		     (insert-file-contents-internal infile nil nil nil nil
+						    'binary))
+		   (setq start (point-min) end (point-max))))
+		((consp infile)
+		 (setq inbuf (get-buffer (car infile)))
+		 (setq start (or (nth 1 infile) (point-min inbuf)))
+		 (setq end (or (nth 2 infile) (point-max inbuf))))
+		((null infile) nil)
+		(t
+		 (error 'wrong-type-argument
+			"Must be filename or (BUFFER [START [END]])"
+			infile)))
+	  ;; now handle BUFFER
+	  (let ((stderr (if (consp buffer) (second buffer) t)))
+	    (if (consp buffer) (setq buffer (car buffer)))
+	    (setq buffer
+		  (cond ((null buffer) nil)
+			((eq buffer t) (current-buffer))
+			;; use integerp for compatibility with existing
+			;; call-process rmsism.
+			((integerp buffer) (setq no-wait t) nil)
+			(t (get-buffer-create buffer))))
+	    (when (and stderr (not (eq t stderr)))
+	      ;; both ERRBUF and STDERR being non-nil indicates to the
+	      ;; code below that STDERR is a file and we should write
+	      ;; ERRBUF to it; so clear out STDERR if we don't want this.
+	      (if (bufferp stderr) (setq errbuf stderr stderr nil)
 		(setq stderr (expand-file-name stderr))
-		(setq errbuf (generate-new-buffer "*call-process*")))
+		(setq kill-errbuf t)
+		(setq errbuf (generate-new-buffer "*call-process*"))))
+	    ;; now start process.  using a pty causes all sorts of
+	    ;; weirdness, at least under cygwin, when there's input. #### i
+	    ;; don't know what's going wrong and whether it's a cygwin-only
+	    ;; problem.  suffice to say that there were NO pty connections
+	    ;; in the old version.
+	    (let ((process-connection-type nil))
 	      (setq proc
 		    (apply 'start-process-internal "*call-process*"
-			   buffer
-			   ;#### not implemented until my new process
-			   ;changes go in.
-			   ;(if (eq t stderr) buffer (list buffer errbuf))
-			   program args))
-	      (if buffer
-		  (set-marker (process-mark proc) (point buffer) buffer))
-	      (unwind-protect
-		  (prog1
-		    (catch 'call-process-done
-		      (when (not discard)
-			(set-process-sentinel
-			 proc
-			 #'(lambda (proc status)
-			     (cond ((eq 'exit (process-status proc))
-				    (set-process-sentinel proc nil)
-				    (throw 'call-process-done
-					   (process-exit-status proc)))
-				   ((eq 'signal (process-status proc))
-				    (set-process-sentinel proc nil)
-				    (throw 'call-process-done status))))))
-		      (when inbuf
-			(process-send-region proc 1
-					     (1+ (buffer-size inbuf)) inbuf))
-		      (process-send-eof proc)
-		      (when discard
-			;; we're trying really really hard to emulate
-			;; the old call-process.
-			(if errbuf
-			    (set-process-sentinel
-			     proc
-			     `(lambda (proc status)
-				(write-region-internal
-				 1 (1+ (buffer-size))
-				 ,stderr
-				 nil 'major-rms-kludge-city nil
-				 coding-system-for-write))))
-			(setq errbuf nil)
-			(setq proc nil)
-			(throw 'call-process-done nil))
-		      (while t
-			(accept-process-output proc)
-			(if display (sit-for 0))))
-		    (when errbuf
-		      (with-current-buffer errbuf
-			(write-region-internal 1 (1+ (buffer-size)) stderr
-					       nil 'major-rms-kludge-city nil
-					       coding-system-for-write))))
-		(if proc (set-process-sentinel proc nil)))))
-	(if inbuf (kill-buffer inbuf))
-	(if errbuf (kill-buffer errbuf))
-	(condition-case nil
-	    (if (and proc (process-live-p proc)) (kill-process proc))
-	  (error nil))))))
-
-(defun call-process (program &optional infile buffer displayp &rest args)
-  "Call PROGRAM synchronously in separate process.
-The program's input comes from file INFILE (nil means `/dev/null').
-Insert output in BUFFER before point; t means current buffer;
- nil for BUFFER means discard it; 0 means discard and don't wait.
-BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
-REAL-BUFFER says what to do with standard output, as above,
-while STDERR-FILE says what to do with standard error in the child.
-STDERR-FILE may be nil (discard standard error output),
-t (mix it with ordinary output), or a file name string.
-
-Fourth arg DISPLAYP non-nil means redisplay buffer as output is inserted.
-Remaining arguments are strings passed as command arguments to PROGRAM.
-
-If BUFFER is 0, `call-process' returns immediately with value nil.
-Otherwise it waits for PROGRAM to terminate and returns a numeric exit status
- or a signal description string.
-If you quit, the process is killed with SIGINT, or SIGKILL if you
- quit again."
-  (apply 'call-process-internal program infile buffer displayp args))
-
-(defun call-process-region (start end program
-                            &optional deletep buffer displayp
-                            &rest args)
-  "Send text from START to END to a synchronous process running PROGRAM.
-Delete the text if fourth arg DELETEP is non-nil.
-
-Insert output in BUFFER before point; t means current buffer;
- nil for BUFFER means discard it; 0 means discard and don't wait.
-BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
-REAL-BUFFER says what to do with standard output, as above,
-while STDERR-FILE says what to do with standard error in the child.
-STDERR-FILE may be nil (discard standard error output),
-t (mix it with ordinary output), or a file name string.
-
-Sixth arg DISPLAYP non-nil means redisplay buffer as output is inserted.
-Remaining args are passed to PROGRAM at startup as command args.
-
-If BUFFER is 0, returns immediately with value nil.
-Otherwise waits for PROGRAM to terminate
-and returns a numeric exit status or a signal description string.
-If you quit, the process is first killed with SIGINT, then with SIGKILL if
-you quit again before the process exits."
-  (let ((temp
-	 (make-temp-name
-	  (concat (file-name-as-directory (temp-directory)) "emacs"))))
-    (unwind-protect
-	(progn
-	  (write-region start end temp nil 'silent)
-	  (if deletep (delete-region start end))
-	  (apply #'call-process program temp buffer displayp args))
-      (ignore-file-errors (delete-file temp)))))
+			   (if (eq t stderr) buffer (list buffer errbuf))
+			   program args)))
+	    ;; see comment above where the data was read from the file.
+	    (if kill-inbuf
+		(set-process-output-coding-system proc 'binary))
+	    ;; point mark/stderr-mark at the right place (by default it's
+	    ;; end of buffer).
+	    (if buffer
+		(set-marker (process-mark proc) (point buffer) buffer))
+	    (if errbuf
+		(set-marker (process-stderr-mark proc) (point errbuf) errbuf))
+	    ;; now do I/O, very carefully!  the unwind-protect makes sure
+	    ;; to clear out the sentinel, since it does a `throw', which would
+	    ;; have no catch (or writes to a file -- we only want this on
+	    ;; normal exit)
+	    (unwind-protect
+		;; if not NO-WAIT, set a sentinel to return the exit
+		;; status.  it will throw to this catch so we can exit
+		;; properly.
+		(catch 'call-process-done
+		  (set-process-sentinel
+		   proc
+		   (if no-wait
+		       ;; we're trying really really hard to emulate
+		       ;; the old call-process, which would save the
+		       ;; stderr to a file even if discarding output.  so
+		       ;; we set a sentinel to save the output when
+		       ;; we finish.
+		       ;;
+		       ;; #### not clear if we should be doing this.
+		       ;;
+		       ;; NOTE NOTE NOTE: Due to the total bogosity of
+		       ;; dynamic scoping, and the lack of closures, we
+		       ;; have to be careful how we write the first
+		       ;; sentinel below since it may be executed after
+		       ;; this function has returned -- thus we fake a
+		       ;; closure. (This doesn't apply to the second one,
+		       ;; which only gets executed within the
+		       ;; unwind-protect.)
+		       (if (and errbuf stderr)
+			   (set-process-sentinel
+			    proc
+			    `(lambda (proc status)
+			       (set-process-sentinel proc nil)
+			       (with-current-buffer ,errbuf
+				 (write-region-internal
+				  1 (1+ (buffer-size))
+				  ,stderr
+				  nil 'major-rms-kludge-city nil
+				  coding-system-for-write))
+			       (kill-buffer ,errbuf))))
+		     ;; normal sentinel: maybe write out stderr and return
+		     ;; status.
+		     #'(lambda (proc status)
+			 (when (and errbuf stderr)
+			   (with-current-buffer errbuf
+			     (write-region-internal
+			      1 (1+ (buffer-size)) stderr
+			      nil 'major-rms-kludge-city nil
+			      coding-system-for-write)))
+			 (cond ((eq 'exit (process-status proc))
+				(set-process-sentinel proc nil)
+				(throw 'call-process-done
+				       (process-exit-status proc)))
+			       ((eq 'signal (process-status proc))
+				(set-process-sentinel proc nil)
+				(throw 'call-process-done status))))))
+		  (if (not no-wait)
+		      ;; we're waiting.  send the input and loop forever,
+		      ;; handling process output and maybe redisplaying.
+		      ;; exit happens through the sentinel or C-g.  if
+		      ;; C-g, send SIGINT the first time, EOF if not
+		      ;; already done so (might make the process exit),
+		      ;; and keep waiting.  Another C-g will exit the
+		      ;; whole function, and the unwind-protect will
+		      ;; kill the process. (Hence the documented semantics
+		      ;; of SIGINT/SIGKILL.)
+		      (let (eof-sent)
+			(condition-case nil
+			    (progn
+			      (when inbuf
+				(process-send-region proc start end inbuf))
+			      (process-send-eof proc)
+			      (setq eof-sent t)
+			      (while t
+				(accept-process-output proc)
+				(if display (sit-for 0))))
+			  (quit
+			   (process-send-signal 'SIGINT proc)
+			   (unless eof-sent
+			     (process-send-eof proc))
+			   (while t
+			     (accept-process-output proc)
+			     (if display (sit-for 0))))))
+		    ;; discard and no wait: send the input, set PROC
+		    ;; and ERRBUF to nil so that the unwind-protect
+		    ;; forms don't erase the sentinel, kill the process,
+		    ;; or kill ERRBUF (the sentinel does that), and exit.
+		    (when inbuf
+		      (process-send-region proc start end inbuf))
+		    (process-send-eof proc)
+		    (setq errbuf nil)
+		    (setq proc nil)))
+	      (if proc (set-process-sentinel proc nil)))))
+      ;; unwind-protect forms.
+      (if (and inbuf kill-inbuf) (kill-buffer inbuf))
+      (if (and errbuf kill-errbuf) (kill-buffer errbuf))
+      (condition-case nil
+	  (if (and proc (process-live-p proc)) (kill-process proc))
+	(error nil)))))
 
 
 (defun shell-command (command &optional output-buffer)
@@ -397,46 +450,6 @@
 		(t
 		 (set-window-start (display-buffer buffer) 1))))))))
 
-
-(defun start-process (name buffer program &rest program-args)
-  "Start a program in a subprocess.  Return the process object for it.
-Args are NAME BUFFER PROGRAM &rest PROGRAM-ARGS
-NAME is name for process.  It is modified if necessary to make it unique.
-BUFFER is the buffer or (buffer-name) to associate with the process.
- Process output goes at end of that buffer, unless you specify
- an output stream or filter function to handle the output.
- BUFFER may be also nil, meaning that this process is not associated
- with any buffer
-Third arg is program file name.  It is searched for as in the shell.
-Remaining arguments are strings to give program as arguments."
-  (apply 'start-process-internal name buffer program program-args))
-
-(defun open-network-stream (name buffer host service &optional protocol)
-  "Open a TCP connection for a service to a host.
-Returns a process object to represent the connection.
-Input and output work as for subprocesses; `delete-process' closes it.
-Args are NAME BUFFER HOST SERVICE.
-NAME is name for process.  It is modified if necessary to make it unique.
-BUFFER is the buffer (or buffer-name) to associate with the process.
- Process output goes at end of that buffer, unless you specify
- an output stream or filter function to handle the output.
- BUFFER may be also nil, meaning that this process is not associated
- with any buffer
-Third arg is name of the host to connect to, or its IP address.
-Fourth arg SERVICE is name of the service desired, or an integer
- specifying a port number to connect to.
-Fifth argument PROTOCOL is a network protocol.  Currently 'tcp
- (Transmission Control Protocol) and 'udp (User Datagram Protocol) are
- supported.  When omitted, 'tcp is assumed.
-
-Output via `process-send-string' and input via buffer or filter (see
-`set-process-filter') are stream-oriented.  That means UDP datagrams are
-not guaranteed to be sent and received in discrete packets. (But small
-datagrams around 500 bytes that are not truncated by `process-send-string'
-are usually fine.)  Note further that UDP protocol does not guard against
-lost packets."
-  (open-network-stream-internal name buffer host service protocol))
-
 (defun shell-quote-argument (argument)
   "Quote an argument for passing as argument to an inferior shell."
   (if (and (eq system-type 'windows-nt)