annotate src/callproc.c @ 6123:3c66892f0083

(pascal-sub-block-re): Recognize for and with.
author Richard M. Stallman <rms@gnu.org>
date Tue, 01 Mar 1994 22:28:47 +0000
parents ae4c6623837b
children 132464faeaf4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 /* Synchronous subprocess invocation for GNU Emacs.
5516
ec5a245c14ed Don't declare sys_errlist; declare strerror instead.
Roland McGrath <roland@gnu.org>
parents: 5501
diff changeset
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994 Free Software Foundation, Inc.
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 This file is part of GNU Emacs.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6 GNU Emacs is free software; you can redistribute it and/or modify
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 it under the terms of the GNU General Public License as published by
5516
ec5a245c14ed Don't declare sys_errlist; declare strerror instead.
Roland McGrath <roland@gnu.org>
parents: 5501
diff changeset
8 the Free Software Foundation; either version 2, or (at your option)
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 any later version.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 GNU Emacs is distributed in the hope that it will be useful,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 GNU General Public License for more details.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 along with GNU Emacs; see the file COPYING. If not, write to
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21 #include <signal.h>
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
22 #include <errno.h>
5688
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
23 #include <stdio.h>
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 3932
diff changeset
25 #include <config.h>
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
27 extern int errno;
5516
ec5a245c14ed Don't declare sys_errlist; declare strerror instead.
Roland McGrath <roland@gnu.org>
parents: 5501
diff changeset
28 extern char *strerror ();
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
29
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 /* Define SIGCHLD as an alias for SIGCLD. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 #if !defined (SIGCHLD) && defined (SIGCLD)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 #define SIGCHLD SIGCLD
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 #endif /* SIGCLD */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 #include <sys/types.h>
3932
9a411d86ca72 (PRIO_PROCESS): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents: 3826
diff changeset
37
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 #include <sys/file.h>
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 #ifdef USG5
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 #include <fcntl.h>
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
43 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
44 #include <fcntl.h>
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
45 #include <sys/stat.h>
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
46 #include <sys/param.h>
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
47 #include <errno.h>
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
48 #endif /* MSDOS */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
49
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 #ifndef O_RDONLY
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 #define O_RDONLY 0
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 #ifndef O_WRONLY
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 #define O_WRONLY 1
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 #include "lisp.h"
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 #include "commands.h"
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 #include "buffer.h"
4701
05f6a91c2801 Include <paths.h>, not "paths.h".
Roland McGrath <roland@gnu.org>
parents: 4696
diff changeset
61 #include <paths.h>
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 #include "process.h"
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
63 #include "syssignal.h"
5348
f921e3c48dcb Include systty.h.
Richard M. Stallman <rms@gnu.org>
parents: 5251
diff changeset
64 #include "systty.h"
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 #ifdef VMS
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 extern noshare char **environ;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 #else
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 extern char **environ;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 #define max(a, b) ((a) > (b) ? (a) : (b))
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
74 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
75 Lisp_Object Vbinary_process;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
76 #endif
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
77
6031
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
78 Lisp_Object Vexec_path, Vexec_directory, Vdata_directory, Vdoc_directory;
3064
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
79 Lisp_Object Vconfigure_info_directory;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 Lisp_Object Vshell_file_name;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 Lisp_Object Vprocess_environment;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 /* True iff we are about to fork off a synchronous process or if we
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 are waiting for it. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 int synch_process_alive;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 /* Nonzero => this is a string explaining death of synchronous subprocess. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 char *synch_process_death;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92 /* If synch_process_death is zero,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 this is exit code of synchronous subprocess. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 int synch_process_retcode;
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
95
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
96 extern Lisp_Object Vdoc_file_name;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 #ifndef VMS /* VMS version is in vmsproc.c. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
100 static Lisp_Object
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
101 call_process_kill (fdpid)
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
102 Lisp_Object fdpid;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
103 {
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
104 close (XFASTINT (Fcar (fdpid)));
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
105 EMACS_KILLPG (XFASTINT (Fcdr (fdpid)), SIGKILL);
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
106 synch_process_alive = 0;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
107 return Qnil;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
108 }
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
109
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110 Lisp_Object
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 call_process_cleanup (fdpid)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 Lisp_Object fdpid;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 {
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
114 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
115 /* for MSDOS fdpid is really (fd . tempfile) */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
116 register Lisp_Object file = Fcdr (fdpid);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
117 close (XFASTINT (Fcar (fdpid)));
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
118 if (strcmp (XSTRING (file)-> data, NULL_DEVICE) != 0)
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
119 unlink (XSTRING (file)->data);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
120 #else /* not MSDOS */
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
121 register int pid = XFASTINT (Fcdr (fdpid));
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
122
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
123 if (EMACS_KILLPG (pid, SIGINT) == 0)
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
124 {
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
125 int count = specpdl_ptr - specpdl;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
126 record_unwind_protect (call_process_kill, fdpid);
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
127 message1 ("Waiting for process to die...(type C-g again to kill it instantly)");
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
128 immediate_quit = 1;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
129 QUIT;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
130 wait_for_termination (pid);
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
131 immediate_quit = 0;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
132 specpdl_ptr = specpdl + count; /* Discard the unwind protect. */
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
133 message1 ("Waiting for process to die...done");
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
134 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 synch_process_alive = 0;
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
136 close (XFASTINT (Fcar (fdpid)));
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
137 #endif /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 return Qnil;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 "Call PROGRAM synchronously in separate process.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143 The program's input comes from file INFILE (nil means `/dev/null').\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 Insert output in BUFFER before point; t means current buffer;\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145 nil for BUFFER means discard it; 0 means discard and don't wait.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 Remaining arguments are strings passed as command arguments to PROGRAM.\n\
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
148 If BUFFER is 0, returns immediately with value nil.\n\
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149 Otherwise waits for PROGRAM to terminate\n\
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
150 and returns a numeric exit status or a signal description string.\n\
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
151 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 (nargs, args)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 int nargs;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 register Lisp_Object *args;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 {
1678
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
156 Lisp_Object infile, buffer, current_dir, display, path;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 int fd[2];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 int filefd;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 register int pid;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160 char buf[1024];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 int count = specpdl_ptr - specpdl;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 register unsigned char **new_argv
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 = (unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *));
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 struct buffer *old = current_buffer;
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
165 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
166 char *outf, *tempfile;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
167 int outfilefd;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
168 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 #if 0
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 int mask;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 CHECK_STRING (args[0], 0);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
174 #ifndef subprocesses
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
175 /* Without asynchronous processes we cannot have BUFFER == 0. */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
176 if (nargs >= 3 && XTYPE (args[2]) == Lisp_Int)
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
177 error ("Operating system cannot handle asynchronous subprocesses");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
178 #endif /* subprocesses */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
179
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
180 if (nargs >= 2 && ! NILP (args[1]))
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
181 {
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
182 infile = Fexpand_file_name (args[1], current_buffer->directory);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
183 CHECK_STRING (infile, 1);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
184 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 else
2432
17a84e60603b New macros NULL_DEVICE and EXEC_SUFFIXES, to give the name of the
Jim Blandy <jimb@redhat.com>
parents: 2286
diff changeset
186 infile = build_string (NULL_DEVICE);
648
70b112526394 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 638
diff changeset
187
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
188 if (nargs >= 3)
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
189 {
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
190 register Lisp_Object tem;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
192 buffer = tem = args[2];
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
193 if (!(EQ (tem, Qnil)
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
194 || EQ (tem, Qt)
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
195 || XFASTINT (tem) == 0))
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
196 {
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
197 buffer = Fget_buffer (tem);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
198 CHECK_BUFFER (buffer, 2);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
199 }
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
200 }
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
201 else
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
202 buffer = Qnil;
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
203
1678
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
204 /* Make sure that the child will be able to chdir to the current
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
205 buffer's current directory, or its unhandled equivalent. We
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
206 can't just have the child check for an error when it does the
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
207 chdir, since it's in a vfork.
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
208
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
209 We have to GCPRO around this because Fexpand_file_name,
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
210 Funhandled_file_name_directory, and Ffile_accessible_directory_p
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
211 might call a file name handling function. The argument list is
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
212 protected by the caller, so all we really have to worry about is
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
213 buffer. */
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
214 {
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
215 struct gcpro gcpro1, gcpro2, gcpro3;
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
216
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
217 current_dir = current_buffer->directory;
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
218
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
219 GCPRO3 (infile, buffer, current_dir);
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
220
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
221 current_dir =
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
222 expand_and_dir_to_file
1886
dd2e31cbf205 * process.c (Fstart_process): Jimb's change of December 11
Michael I. Bushnell <mib@gnu.org>
parents: 1678
diff changeset
223 (Funhandled_file_name_directory (current_dir), Qnil);
1678
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
224 if (NILP (Ffile_accessible_directory_p (current_dir)))
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
225 report_file_error ("Setting current directory",
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
226 Fcons (current_buffer->directory, Qnil));
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
227
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
228 UNGCPRO;
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
229 }
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
230
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
231 display = nargs >= 4 ? args[3] : Qnil;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234 register int i;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 for (i = 4; i < nargs; i++)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 CHECK_STRING (args[i], i);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238 new_argv[i - 3] = XSTRING (args[i])->data;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 /* Program name is first command arg */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 new_argv[0] = XSTRING (args[0])->data;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 new_argv[i - 3] = 0;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
245 filefd = open (XSTRING (infile)->data, O_RDONLY, 0);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 if (filefd < 0)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247 {
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
248 report_file_error ("Opening process input file", Fcons (infile, Qnil));
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 /* Search for program; barf if not found. */
2432
17a84e60603b New macros NULL_DEVICE and EXEC_SUFFIXES, to give the name of the
Jim Blandy <jimb@redhat.com>
parents: 2286
diff changeset
251 openp (Vexec_path, args[0], EXEC_SUFFIXES, &path, 1);
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
252 if (NILP (path))
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 close (filefd);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255 report_file_error ("Searching for program", Fcons (args[0], Qnil));
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 new_argv[0] = XSTRING (path)->data;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
259 #ifdef MSDOS /* MW, July 1993 */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
260 /* These vars record information from process termination.
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
261 Clear them now before process can possibly terminate,
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
262 to avoid timing error if process terminates soon. */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
263 synch_process_death = 0;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
264 synch_process_retcode = 0;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
265
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
266 if ((outf = egetenv ("TMP")) || (outf = egetenv ("TEMP")))
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
267 strcpy (tempfile = alloca (strlen (outf) + 20), outf);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
268 else
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
269 {
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
270 tempfile = alloca (20);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
271 *tempfile = '\0';
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
272 }
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
273 dostounix_filename (tempfile);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
274 if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/')
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
275 strcat (tempfile, "/");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
276 strcat (tempfile, "detmp.XXX");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
277 mktemp (tempfile);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
278
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
279 outfilefd = creat (tempfile, S_IREAD | S_IWRITE);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
280 if (outfilefd < 0)
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
281 {
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
282 close (filefd);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
283 report_file_error ("Opening process output file", Fcons (tempfile, Qnil));
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
284 }
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
285 #endif
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
286
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 if (XTYPE (buffer) == Lisp_Int)
2432
17a84e60603b New macros NULL_DEVICE and EXEC_SUFFIXES, to give the name of the
Jim Blandy <jimb@redhat.com>
parents: 2286
diff changeset
288 fd[1] = open (NULL_DEVICE, O_WRONLY), fd[0] = -1;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 else
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 {
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
291 #ifndef MSDOS
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 pipe (fd);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
293 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 #if 0
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 /* Replaced by close_process_descs */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 set_exclusive_use (fd[0]);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 /* child_setup must clobber environ in systems with true vfork.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 Protect it from permanent change. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303 register char **save_environ = environ;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 register int fd1 = fd[1];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 #if 0 /* Some systems don't have sigblock. */
638
40b255f55df3 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
307 mask = sigblock (sigmask (SIGCHLD));
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 /* Record that we're about to create a synchronous process. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 synch_process_alive = 1;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312
4977
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
313 /* These vars record information from process termination.
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
314 Clear them now before process can possibly terminate,
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
315 to avoid timing error if process terminates soon. */
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
316 synch_process_death = 0;
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
317 synch_process_retcode = 0;
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
318
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
319 #ifdef MSDOS /* MW, July 1993 */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
320 pid = run_msdos_command (new_argv, current_dir, filefd, outfilefd);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
321 close (outfilefd);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
322 fd1 = -1; /* No harm in closing that one! */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
323 fd[0] = open (tempfile, NILP (Vbinary_process) ? O_TEXT : O_BINARY);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
324 if (fd[0] < 0)
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
325 {
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
326 unlink (tempfile);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
327 report_file_error ("Cannot re-open temporary file", Qnil);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
328 }
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
329 #else /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 pid = vfork ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 if (pid == 0)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 if (fd[0] >= 0)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 close (fd[0]);
3826
647bef18618f Changes for Irix 4.0, tested this time:
Jim Blandy <jimb@redhat.com>
parents: 3814
diff changeset
336 #ifdef USG
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 setpgrp ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 #else
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 setpgrp (pid, pid);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 #endif /* USG */
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
341 child_setup (filefd, fd1, fd1, new_argv, 0, current_dir);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 }
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
343 #endif /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345 #if 0
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 /* Tell SIGCHLD handler to look for this pid. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 synch_process_pid = pid;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 /* Now let SIGCHLD come through. */
638
40b255f55df3 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
349 sigsetmask (mask);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 environ = save_environ;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 close (filefd);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
355 if (fd1 >= 0)
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
356 close (fd1);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 if (pid < 0)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 close (fd[0]);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 report_file_error ("Doing vfork", Qnil);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 if (XTYPE (buffer) == Lisp_Int)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 #ifndef subprocesses
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
368 /* If Emacs has been built with asynchronous subprocess support,
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
369 we don't need to do this, I think because it will then have
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
370 the facilities for handling SIGCHLD. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 wait_without_blocking ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 #endif /* subprocesses */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 return Qnil;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
376 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
377 /* MSDOS needs different cleanup information. */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
378 record_unwind_protect (call_process_cleanup,
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
379 Fcons (make_number (fd[0]), build_string (tempfile)));
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
380 #else
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 record_unwind_protect (call_process_cleanup,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 Fcons (make_number (fd[0]), make_number (pid)));
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
383 #endif /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 if (XTYPE (buffer) == Lisp_Buffer)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 Fset_buffer (buffer);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 immediate_quit = 1;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 QUIT;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 register int nread;
5251
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
394 int first = 1;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396 while ((nread = read (fd[0], buf, sizeof buf)) > 0)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 immediate_quit = 0;
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
399 if (!NILP (buffer))
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400 insert (buf, nread);
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
401 if (!NILP (display) && INTERACTIVE)
5251
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
402 {
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
403 if (first)
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
404 prepare_menu_bars ();
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
405 first = 0;
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
406 redisplay_preserve_echo_area ();
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
407 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 immediate_quit = 1;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 QUIT;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 /* Wait for it to terminate, unless it already has. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 wait_for_termination (pid);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 immediate_quit = 0;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 set_buffer_internal (old);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 unbind_to (count, Qnil);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 if (synch_process_death)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423 return build_string (synch_process_death);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 return make_number (synch_process_retcode);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427
1912
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
428 static Lisp_Object
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 delete_temp_file (name)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 Lisp_Object name;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432 unlink (XSTRING (name)->data);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435 DEFUN ("call-process-region", Fcall_process_region, Scall_process_region,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 3, MANY, 0,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437 "Send text from START to END to a synchronous process running PROGRAM.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438 Delete the text if fourth arg DELETE is non-nil.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439 Insert output in BUFFER before point; t means current buffer;\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 nil for BUFFER means discard it; 0 means discard and don't wait.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441 Sixth arg DISPLAY non-nil means redisplay buffer as output is inserted.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 Remaining args are passed to PROGRAM at startup as command args.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443 If BUFFER is nil, returns immediately with value nil.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444 Otherwise waits for PROGRAM to terminate\n\
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
445 and returns a numeric exit status or a signal description string.\n\
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
446 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.")
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447 (nargs, args)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448 int nargs;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
449 register Lisp_Object *args;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 register Lisp_Object filename_string, start, end;
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
452 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
453 char *tempfile;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
454 #else
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 char tempfile[20];
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
456 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 int count = specpdl_ptr - specpdl;
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
458 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
459 char *outf = '\0';
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
460
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
461 if ((outf = egetenv ("TMP")) || (outf = egetenv ("TEMP")))
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
462 strcpy (tempfile = alloca (strlen (outf) + 20), outf);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
463 else
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
464 {
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
465 tempfile = alloca (20);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
466 *tempfile = '\0';
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
467 }
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
468 dostounix_filename (tempfile);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
469 if (tempfile[strlen (tempfile) - 1] != '/')
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
470 strcat (tempfile, "/");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
471 strcat (tempfile, "detmp.XXX");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
472 #else /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 #ifdef VMS
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 strcpy (tempfile, "tmp:emacsXXXXXX.");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 #else
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 strcpy (tempfile, "/tmp/emacsXXXXXX");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 #endif
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
479 #endif /* not MSDOS */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
480
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481 mktemp (tempfile);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483 filename_string = build_string (tempfile);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 start = args[0];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485 end = args[1];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 Fwrite_region (start, end, filename_string, Qnil, Qlambda);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 record_unwind_protect (delete_temp_file, filename_string);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
489 if (!NILP (args[3]))
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
490 Fdelete_region (start, end);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 args[3] = filename_string;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
493
1678
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
494 return unbind_to (count, Fcall_process (nargs - 2, args + 2));
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
495 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
497 #ifndef VMS /* VMS version is in vmsproc.c. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
499 /* This is the last thing run in a newly forked inferior
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
500 either synchronous or asynchronous.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 Copy descriptors IN, OUT and ERR as descriptors 0, 1 and 2.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
502 Initialize inferior's priority, pgrp, connected dir and environment.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
503 then exec another program based on new_argv.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
504
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 This function may change environ for the superior process.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
506 Therefore, the superior process must save and restore the value
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507 of environ around the vfork and the call to this function.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509 ENV is the environment for the subprocess.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
511 SET_PGRP is nonzero if we should put the subprocess into a separate
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
512 process group.
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
513
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
514 CURRENT_DIR is an elisp string giving the path of the current
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
515 directory the subprocess should have. Since we can't really signal
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
516 a decent error from within the child, this should be verified as an
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
517 executable directory by the parent. */
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
518
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
519 child_setup (in, out, err, new_argv, set_pgrp, current_dir)
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
520 int in, out, err;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
521 register char **new_argv;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522 int set_pgrp;
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
523 Lisp_Object current_dir;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
524 {
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
525 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
526 /* The MSDOS port of gcc cannot fork, vfork, ... so we must call system
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
527 instead. */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
528 #else /* not MSDOS */
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
529 char **env;
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
530
5530
7ff479a8e8bf (child_setup): Don't declare PID `register'; we later take its address.
Roland McGrath <roland@gnu.org>
parents: 5516
diff changeset
531 int pid = getpid ();
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
532
1201
4ea86d32c012 * callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents: 948
diff changeset
533 {
4ea86d32c012 * callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents: 948
diff changeset
534 extern int emacs_priority;
4ea86d32c012 * callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents: 948
diff changeset
535
4ea86d32c012 * callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents: 948
diff changeset
536 nice (- emacs_priority);
4ea86d32c012 * callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents: 948
diff changeset
537 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
538
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
539 #ifdef subprocesses
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
540 /* Close Emacs's descriptors that this process should not have. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541 close_process_descs ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
542 #endif
5569
b9e2884ca8e6 (child_setup): Call close_load_descs.
Richard M. Stallman <rms@gnu.org>
parents: 5530
diff changeset
543 close_load_descs ();
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
544
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
545 /* Note that use of alloca is always safe here. It's obvious for systems
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
546 that do not have true vfork or that have true (stack) alloca.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
547 If using vfork and C_ALLOCA it is safe because that changes
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
548 the superior's static variables as if the superior had done alloca
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
549 and will be cleaned up in the usual way. */
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
550 {
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
551 register unsigned char *temp;
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
552 register int i;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
553
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
554 i = XSTRING (current_dir)->size;
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
555 temp = (unsigned char *) alloca (i + 2);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
556 bcopy (XSTRING (current_dir)->data, temp, i);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
557 if (temp[i - 1] != '/') temp[i++] = '/';
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
558 temp[i] = 0;
538
c3e1fe268e78 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 493
diff changeset
559
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
560 /* We can't signal an Elisp error here; we're in a vfork. Since
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
561 the callers check the current directory before forking, this
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
562 should only return an error if the directory's permissions
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
563 are changed between the check and this chdir, but we should
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
564 at least check. */
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
565 if (chdir (temp) < 0)
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
566 exit (errno);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
567 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 /* Set `env' to a vector of the strings in Vprocess_environment. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571 register Lisp_Object tem;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572 register char **new_env;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573 register int new_length;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575 new_length = 0;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
576 for (tem = Vprocess_environment;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 (XTYPE (tem) == Lisp_Cons
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 && XTYPE (XCONS (tem)->car) == Lisp_String);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 tem = XCONS (tem)->cdr)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 new_length++;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
581
2757
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
582 /* new_length + 1 to include terminating 0. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
583 env = new_env = (char **) alloca ((new_length + 1) * sizeof (char *));
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584
2757
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
585 /* Copy the Vprocess_environment strings into new_env. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
586 for (tem = Vprocess_environment;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
587 (XTYPE (tem) == Lisp_Cons
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
588 && XTYPE (XCONS (tem)->car) == Lisp_String);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589 tem = XCONS (tem)->cdr)
2757
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
590 {
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
591 char **ep = env;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
592 char *string = (char *) XSTRING (XCONS (tem)->car)->data;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
593 /* See if this string duplicates any string already in the env.
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
594 If so, don't put it in.
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
595 When an env var has multiple definitions,
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
596 we keep the definition that comes first in process-environment. */
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
597 for (; ep != new_env; ep++)
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
598 {
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
599 char *p = *ep, *q = string;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
600 while (1)
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
601 {
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
602 if (*q == 0)
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
603 /* The string is malformed; might as well drop it. */
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
604 goto duplicate;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
605 if (*q != *p)
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
606 break;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
607 if (*q == '=')
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
608 goto duplicate;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
609 p++, q++;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
610 }
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
611 }
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
612 *new_env++ = string;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
613 duplicate: ;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
614 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
615 *new_env = 0;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
616 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
617
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
618 /* Make sure that in, out, and err are not actually already in
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
619 descriptors zero, one, or two; this could happen if Emacs is
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
620 started with its standard in, out, or error closed, as might
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
621 happen under X. */
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
622 in = relocate_fd (in, 3);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
623 out = relocate_fd (out, 3);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
624 err = relocate_fd (err, 3);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
625
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
626 close (0);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
627 close (1);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
628 close (2);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
629
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
630 dup2 (in, 0);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
631 dup2 (out, 1);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
632 dup2 (err, 2);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
633 close (in);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
634 close (out);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
635 close (err);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
636
5179
2a1492764d5e (child_setup): Test SETPGRP_RELEASES_CTTY, not IRIX.
Richard M. Stallman <rms@gnu.org>
parents: 5154
diff changeset
637 #ifdef USG
2a1492764d5e (child_setup): Test SETPGRP_RELEASES_CTTY, not IRIX.
Richard M. Stallman <rms@gnu.org>
parents: 5154
diff changeset
638 #ifndef SETPGRP_RELEASES_CTTY
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
639 setpgrp (); /* No arguments but equivalent in this case */
5179
2a1492764d5e (child_setup): Test SETPGRP_RELEASES_CTTY, not IRIX.
Richard M. Stallman <rms@gnu.org>
parents: 5154
diff changeset
640 #endif
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
641 #else
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
642 setpgrp (pid, pid);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
643 #endif /* USG */
5348
f921e3c48dcb Include systty.h.
Richard M. Stallman <rms@gnu.org>
parents: 5251
diff changeset
644 /* setpgrp_of_tty is incorrect here; it uses input_fd. */
f921e3c48dcb Include systty.h.
Richard M. Stallman <rms@gnu.org>
parents: 5251
diff changeset
645 EMACS_SET_TTY_PGRP (0, &pid);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
646
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
647 #ifdef vipc
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
648 something missing here;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
649 #endif /* vipc */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
650
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
651 /* execvp does not accept an environment arg so the only way
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
652 to pass this environment is to set environ. Our caller
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
653 is responsible for restoring the ambient value of environ. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
654 environ = env;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
655 execvp (new_argv[0], new_argv);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
656
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
657 write (1, "Couldn't exec the program ", 26);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
658 write (1, new_argv[0], strlen (new_argv[0]));
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
659 _exit (1);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
660 #endif /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
661 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
662
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
663 /* Move the file descriptor FD so that its number is not less than MIN.
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
664 If the file descriptor is moved at all, the original is freed. */
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
665 int
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
666 relocate_fd (fd, min)
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
667 int fd, min;
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
668 {
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
669 if (fd >= min)
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
670 return fd;
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
671 else
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
672 {
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
673 int new = dup (fd);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
674 if (new == -1)
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
675 {
2509
daaa78c8c980 * callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents: 2432
diff changeset
676 char *message1 = "Error while setting up child: ";
5516
ec5a245c14ed Don't declare sys_errlist; declare strerror instead.
Roland McGrath <roland@gnu.org>
parents: 5501
diff changeset
677 char *errmessage = strerror (errno);
2509
daaa78c8c980 * callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents: 2432
diff changeset
678 char *message2 = "\n";
daaa78c8c980 * callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents: 2432
diff changeset
679 write (2, message1, strlen (message1));
5516
ec5a245c14ed Don't declare sys_errlist; declare strerror instead.
Roland McGrath <roland@gnu.org>
parents: 5501
diff changeset
680 write (2, errmessage, strlen (errmessage));
2509
daaa78c8c980 * callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents: 2432
diff changeset
681 write (2, message2, strlen (message2));
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
682 _exit (1);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
683 }
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
684 /* Note that we hold the original FD open while we recurse,
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
685 to guarantee we'll get a new FD if we need it. */
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
686 new = relocate_fd (new, min);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
687 close (fd);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
688 return new;
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
689 }
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
690 }
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
691
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
692 static int
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
693 getenv_internal (var, varlen, value, valuelen)
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
694 char *var;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
695 int varlen;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
696 char **value;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
697 int *valuelen;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
698 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
699 Lisp_Object scan;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
700
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
701 for (scan = Vprocess_environment; CONSP (scan); scan = XCONS (scan)->cdr)
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
702 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
703 Lisp_Object entry = XCONS (scan)->car;
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
704
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
705 if (XTYPE (entry) == Lisp_String
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
706 && XSTRING (entry)->size > varlen
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
707 && XSTRING (entry)->data[varlen] == '='
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
708 && ! bcmp (XSTRING (entry)->data, var, varlen))
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
709 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
710 *value = (char *) XSTRING (entry)->data + (varlen + 1);
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
711 *valuelen = XSTRING (entry)->size - (varlen + 1);
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
712 return 1;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
713 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
714 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
715
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
716 return 0;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
717 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
718
5251
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
719 DEFUN ("getenv", Fgetenv, Sgetenv, 1, 1, 0,
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
720 "Return the value of environment variable VAR, as a string.\n\
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
721 VAR should be a string. Value is nil if VAR is undefined in the environment.\n\
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
722 This function consults the variable ``process-environment'' for its value.")
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
723 (var)
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
724 Lisp_Object var;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
725 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
726 char *value;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
727 int valuelen;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
728
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
729 CHECK_STRING (var, 0);
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
730 if (getenv_internal (XSTRING (var)->data, XSTRING (var)->size,
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
731 &value, &valuelen))
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
732 return make_string (value, valuelen);
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
733 else
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
734 return Qnil;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
735 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
736
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
737 /* A version of getenv that consults process_environment, easily
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
738 callable from C. */
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
739 char *
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
740 egetenv (var)
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
741 char *var;
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
742 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
743 char *value;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
744 int valuelen;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
745
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
746 if (getenv_internal (var, strlen (var), &value, &valuelen))
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
747 return value;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
748 else
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
749 return 0;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
750 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
751
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
752 #endif /* not VMS */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
753
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
754 /* This is run before init_cmdargs. */
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
755
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
756 init_callproc_1 ()
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
757 {
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
758 char *data_dir = egetenv ("EMACSDATA");
6031
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
759 char *doc_dir = egetenv ("EMACSDOC");
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
760
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
761 Vdata_directory
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
762 = Ffile_name_as_directory (build_string (data_dir ? data_dir
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
763 : PATH_DATA));
6031
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
764 Vdoc_directory
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
765 = Ffile_name_as_directory (build_string (doc_dir ? doc_dir
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
766 : PATH_DOC));
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
767
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
768 /* Check the EMACSPATH environment variable, defaulting to the
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
769 PATH_EXEC path from paths.h. */
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
770 Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
771 Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
772 Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path);
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
773 }
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
774
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
775 /* This is run after init_cmdargs, so that Vinvocation_directory is valid. */
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
776
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
777 init_callproc ()
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
778 {
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
779 char *data_dir = egetenv ("EMACSDATA");
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
780
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
781 register char * sh;
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
782 Lisp_Object tempdir;
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
783
5618
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
784 if (initialized && !NILP (Vinstallation_directory))
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
785 {
5618
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
786 /* Add to the path the lib-src subdir of the installation dir. */
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
787 Lisp_Object tem;
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
788 tem = Fexpand_file_name (build_string ("lib-src"),
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
789 Vinstallation_directory);
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
790 if (NILP (Fmember (tem, Vexec_path)))
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
791 {
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
792 Vexec_path = nconc2 (Vexec_path, Fcons (tem, Qnil));
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
793 Vexec_directory = Ffile_name_as_directory (tem);
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
794
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
795 /* If we use ../lib-src, maybe use ../etc as well.
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
796 Do so if ../etc exists and has our DOC-... file in it. */
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
797 if (data_dir == 0)
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
798 {
5618
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
799 tem = Fexpand_file_name (build_string ("etc"),
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
800 Vinstallation_directory);
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
801 Vdata_directory = Ffile_name_as_directory (tem);
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
802 }
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
803 }
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
804 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
805
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
806 tempdir = Fdirectory_file_name (Vexec_directory);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
807 if (access (XSTRING (tempdir)->data, 0) < 0)
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
808 {
5688
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
809 fprintf (stderr,
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
810 "Warning: arch-dependent data dir (%s) does not exist.\n",
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
811 XSTRING (Vexec_directory)->data);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
812 sleep (2);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
813 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
814
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
815 tempdir = Fdirectory_file_name (Vdata_directory);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
816 if (access (XSTRING (tempdir)->data, 0) < 0)
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
817 {
5688
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
818 fprintf (stderr,
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
819 "Warning: arch-independent data dir (%s) does not exist.\n",
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
820 XSTRING (Vdata_directory)->data);
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
821 sleep (2);
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
822 }
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
823
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
824 #ifdef VMS
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
825 Vshell_file_name = build_string ("*dcl*");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
826 #else
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
827 sh = (char *) getenv ("SHELL");
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
828 Vshell_file_name = build_string (sh ? sh : "/bin/sh");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
829 #endif
1912
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
830 }
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
831
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
832 set_process_environment ()
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
833 {
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
834 register char **envp;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
835
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
836 Vprocess_environment = Qnil;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
837 #ifndef CANNOT_DUMP
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
838 if (initialized)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
839 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
840 for (envp = environ; *envp; envp++)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
841 Vprocess_environment = Fcons (build_string (*envp),
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
842 Vprocess_environment);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
843 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
844
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
845 syms_of_callproc ()
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
846 {
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
847 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
848 DEFVAR_LISP ("binary-process", &Vbinary_process,
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
849 "*If non-nil then new subprocesses are assumed to produce binary output.");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
850 Vbinary_process = Qnil;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
851 #endif
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
852
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
853 DEFVAR_LISP ("shell-file-name", &Vshell_file_name,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
854 "*File name to load inferior shells from.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
855 Initialized from the SHELL environment variable.");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
856
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
857 DEFVAR_LISP ("exec-path", &Vexec_path,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
858 "*List of directories to search programs to run in subprocesses.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
859 Each element is a string (directory name) or nil (try default directory).");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
860
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
861 DEFVAR_LISP ("exec-directory", &Vexec_directory,
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
862 "Directory of architecture-dependent files that come with GNU Emacs,\n\
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
863 especially executable programs intended for Emacs to invoke.");
439
350065270fc8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
864
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
865 DEFVAR_LISP ("data-directory", &Vdata_directory,
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
866 "Directory of architecture-independent files that come with GNU Emacs,\n\
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
867 intended for Emacs to use.");
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
868
6031
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
869 DEFVAR_LISP ("doc-directory", &Vdoc_directory,
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
870 "Directory containing the DOC file that comes with GNU Emacs.\n\
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
871 This is usually the same as data-directory.");
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
872
3064
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
873 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory,
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
874 "For internal use by the build procedure only.\n\
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
875 This is the name of the directory in which the build procedure installed\n\
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
876 Emacs's info files; the default value for Info-default-directory-list\n\
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
877 includes this.");
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
878 Vconfigure_info_directory = build_string (PATH_INFO);
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
879
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
880 DEFVAR_LISP ("process-environment", &Vprocess_environment,
948
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
881 "List of environment variables for subprocesses to inherit.\n\
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
882 Each element should be a string of the form ENVVARNAME=VALUE.\n\
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
883 The environment which Emacs inherits is placed in this variable\n\
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
884 when Emacs starts.");
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
885
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
886 #ifndef VMS
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
887 defsubr (&Scall_process);
1596
0e105bd23f44 * systty.h, process.c, buffer.h, callproc.c, sysdep.c, dired.c:
Jim Blandy <jimb@redhat.com>
parents: 1504
diff changeset
888 defsubr (&Sgetenv);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
890 defsubr (&Scall_process_region);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
891 }