annotate src/callproc.c @ 9033:3c36c72db2bb

*** empty log message ***
author Paul Reilly <pmr@pajato.com>
date Sat, 24 Sep 1994 00:12:06 +0000
parents f44e40e722b2
children 6c814eb4d892
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>
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23
4696
1fc792473491 Include <config.h> instead of "config.h".
Roland McGrath <roland@gnu.org>
parents: 3932
diff changeset
24 #include <config.h>
7900
60795e826dad Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents: 7824
diff changeset
25 #include <stdio.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
6818
6a9b0b5399ce If we include fcntl.h, define INCLUDED_FCNTL.
Richard M. Stallman <rms@gnu.org>
parents: 6614
diff changeset
40 #define INCLUDED_FCNTL
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 #include <fcntl.h>
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
44 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
7782
5fc8a3a9539a [MSDOS]: #include "msdos.h" for rootrelativepath template.
Karl Heuer <kwzh@gnu.org>
parents: 7722
diff changeset
45 #include "msdos.h"
6818
6a9b0b5399ce If we include fcntl.h, define INCLUDED_FCNTL.
Richard M. Stallman <rms@gnu.org>
parents: 6614
diff changeset
46 #define INCLUDED_FCNTL
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
47 #include <fcntl.h>
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
48 #include <sys/stat.h>
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
49 #include <sys/param.h>
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
50 #include <errno.h>
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
51 #endif /* MSDOS */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
52
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 #ifndef O_RDONLY
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 #define O_RDONLY 0
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 #ifndef O_WRONLY
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 #define O_WRONLY 1
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 #include "lisp.h"
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 #include "commands.h"
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 #include "buffer.h"
4701
05f6a91c2801 Include <paths.h>, not "paths.h".
Roland McGrath <roland@gnu.org>
parents: 4696
diff changeset
64 #include <paths.h>
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 #include "process.h"
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
66 #include "syssignal.h"
5348
f921e3c48dcb Include systty.h.
Richard M. Stallman <rms@gnu.org>
parents: 5251
diff changeset
67 #include "systty.h"
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 #ifdef VMS
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 extern noshare char **environ;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 #else
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 extern char **environ;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 #define max(a, b) ((a) > (b) ? (a) : (b))
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
77 #ifdef MSDOS
7397
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
78 /* When we are starting external processes we need to know whether they
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
79 take binary input (no conversion) or text input (\n is converted to
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
80 \r\n). Similar for output: if newlines are written as \r\n then it's
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
81 text process output, otherwise it's binary. */
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
82 Lisp_Object Vbinary_process_input;
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
83 Lisp_Object Vbinary_process_output;
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
84 #endif
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
85
6031
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
86 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
87 Lisp_Object Vconfigure_info_directory;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 Lisp_Object Vshell_file_name;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 Lisp_Object Vprocess_environment;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92
7397
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
93 #ifdef MSDOS
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
94 Lisp_Object Qbuffer_file_type;
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
95 #endif
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
96
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 /* 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
98 are waiting for it. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 int synch_process_alive;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101 /* Nonzero => this is a string explaining death of synchronous subprocess. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 char *synch_process_death;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 /* If synch_process_death is zero,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 this is exit code of synchronous subprocess. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 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
107
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
108 extern Lisp_Object Vdoc_file_name;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109
6275
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
110 /* Clean up when exiting Fcall_process.
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
111 On MSDOS, delete the temporary file on any kind of termination.
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
112 On Unix, kill the process and any children on termination by signal. */
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
113
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
114 /* Nonzero if this is termination due to exit. */
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
115 static int call_process_exited;
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
116
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 #ifndef VMS /* VMS version is in vmsproc.c. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
119 static Lisp_Object
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
120 call_process_kill (fdpid)
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
121 Lisp_Object 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 close (XFASTINT (Fcar (fdpid)));
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
124 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
125 synch_process_alive = 0;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
126 return Qnil;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
127 }
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
128
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 Lisp_Object
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130 call_process_cleanup (fdpid)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 Lisp_Object fdpid;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 {
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
133 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
134 /* for MSDOS fdpid is really (fd . tempfile) */
6495
c88f34090aea (call_process_cleanup, getenv_internal): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents: 6466
diff changeset
135 register Lisp_Object file;
c88f34090aea (call_process_cleanup, getenv_internal): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents: 6466
diff changeset
136 file = Fcdr (fdpid);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
137 close (XFASTINT (Fcar (fdpid)));
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
138 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
139 unlink (XSTRING (file)->data);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
140 #else /* not MSDOS */
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
141 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
142
6466
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
143
6275
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
144 if (call_process_exited)
6466
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
145 {
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
146 close (XFASTINT (Fcar (fdpid)));
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
147 return Qnil;
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
148 }
6275
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
149
1504
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
150 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
151 {
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
152 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
153 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
154 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
155 immediate_quit = 1;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
156 QUIT;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
157 wait_for_termination (pid);
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
158 immediate_quit = 0;
e074a2236b00 * callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents: 1201
diff changeset
159 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
160 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
161 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 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
163 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
164 #endif /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 return Qnil;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168 DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 "Call PROGRAM synchronously in separate process.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 The program's input comes from file INFILE (nil means `/dev/null').\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171 Insert output in BUFFER before point; t means current buffer;\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 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
173 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 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
175 If BUFFER is 0, returns immediately with value nil.\n\
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 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
177 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
178 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
179 (nargs, args)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 int nargs;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181 register Lisp_Object *args;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 {
1678
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
183 Lisp_Object infile, buffer, current_dir, display, path;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184 int fd[2];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 int filefd;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 register int pid;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 char buf[1024];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 int count = specpdl_ptr - specpdl;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189 register unsigned char **new_argv
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 = (unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *));
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 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
192 #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
193 char *outf, *tempfile;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
194 int outfilefd;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
195 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 #if 0
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197 int mask;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199 CHECK_STRING (args[0], 0);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
201 #ifndef subprocesses
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
202 /* 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
203 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
204 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
205 #endif /* subprocesses */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
206
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
207 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
208 {
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
209 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
210 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
211 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 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
213 infile = build_string (NULL_DEVICE);
648
70b112526394 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 638
diff changeset
214
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
215 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
216 {
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
217 register Lisp_Object tem;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218
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
219 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
220 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
221 || 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
222 || 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
223 {
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
224 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
225 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
226 }
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
227 }
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
228 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
229 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
230
1678
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
231 /* 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
232 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
233 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
234 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
235
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
236 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
237 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
238 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
239 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
240 buffer. */
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
241 {
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
242 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
243
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
244 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
245
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
246 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
247
6391
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
248 current_dir
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
249 = expand_and_dir_to_file (Funhandled_file_name_directory (current_dir),
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
250 Qnil);
1678
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
251 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
252 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
253 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
254
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
255 UNGCPRO;
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
256 }
62ecf0c5b54c Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents: 1596
diff changeset
257
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
258 display = nargs >= 4 ? args[3] : Qnil;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259
6391
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
260 filefd = open (XSTRING (infile)->data, O_RDONLY, 0);
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
261 if (filefd < 0)
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
262 {
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
263 report_file_error ("Opening process input file", Fcons (infile, Qnil));
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
264 }
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
265 /* Search for program; barf if not found. */
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
266 {
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
267 struct gcpro gcpro1;
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
268
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
269 GCPRO1 (current_dir);
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
270 openp (Vexec_path, args[0], EXEC_SUFFIXES, &path, 1);
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
271 UNGCPRO;
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
272 }
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
273 if (NILP (path))
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
274 {
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
275 close (filefd);
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
276 report_file_error ("Searching for program", Fcons (args[0], Qnil));
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
277 }
d4fe8a853557 (Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents: 6275
diff changeset
278 new_argv[0] = XSTRING (path)->data;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 register int i;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 for (i = 4; i < nargs; i++)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 CHECK_STRING (args[i], i);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284 new_argv[i - 3] = XSTRING (args[i])->data;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 new_argv[i - 3] = 0;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
289 #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
290 /* 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
291 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
292 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
293 synch_process_death = 0;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
294 synch_process_retcode = 0;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
295
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
296 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
297 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
298 else
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
299 {
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
300 tempfile = alloca (20);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
301 *tempfile = '\0';
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
302 }
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
303 dostounix_filename (tempfile);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
304 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
305 strcat (tempfile, "/");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
306 strcat (tempfile, "detmp.XXX");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
307 mktemp (tempfile);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
308
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
309 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
310 if (outfilefd < 0)
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
311 {
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
312 close (filefd);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
313 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
314 }
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
315 #endif
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
316
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 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
318 fd[1] = open (NULL_DEVICE, O_WRONLY), fd[0] = -1;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 else
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 {
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
321 #ifndef MSDOS
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 pipe (fd);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
323 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 #if 0
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 /* Replaced by close_process_descs */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 set_exclusive_use (fd[0]);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 /* child_setup must clobber environ in systems with true vfork.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 Protect it from permanent change. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 register char **save_environ = environ;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 register int fd1 = fd[1];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 #if 0 /* Some systems don't have sigblock. */
638
40b255f55df3 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 624
diff changeset
337 mask = sigblock (sigmask (SIGCHLD));
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 /* Record that we're about to create a synchronous process. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 synch_process_alive = 1;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342
4977
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
343 /* 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
344 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
345 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
346 synch_process_death = 0;
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
347 synch_process_retcode = 0;
81c44a01ddda (Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents: 4701
diff changeset
348
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
349 #ifdef MSDOS /* MW, July 1993 */
6466
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
350 /* ??? Someone who knows MSDOG needs to check whether this properly
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
351 closes all descriptors that it opens. */
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
352 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
353 close (outfilefd);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
354 fd1 = -1; /* No harm in closing that one! */
7397
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
355 fd[0] = open (tempfile, NILP (Vbinary_process_output) ? O_TEXT : O_BINARY);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
356 if (fd[0] < 0)
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
357 {
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
358 unlink (tempfile);
6466
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
359 close (filefd);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
360 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
361 }
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
362 #else /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363 pid = vfork ();
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 (pid == 0)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 if (fd[0] >= 0)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 close (fd[0]);
3826
647bef18618f Changes for Irix 4.0, tested this time:
Jim Blandy <jimb@redhat.com>
parents: 3814
diff changeset
369 #ifdef USG
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 setpgrp ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 #else
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 setpgrp (pid, pid);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 #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
374 child_setup (filefd, fd1, fd1, new_argv, 0, current_dir);
296
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 #endif /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 environ = save_environ;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379
6466
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
380 /* Close most of our fd's, but not fd[0]
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
381 since we will use that to read input from. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 close (filefd);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
383 if (fd1 >= 0)
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
384 close (fd1);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 if (pid < 0)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388 {
6466
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
389 if (fd[0] >= 0)
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
390 close (fd[0]);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 report_file_error ("Doing vfork", Qnil);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394 if (XTYPE (buffer) == Lisp_Int)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 {
6466
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
396 if (fd[0] >= 0)
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
397 close (fd[0]);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 #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
399 /* 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
400 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
401 the facilities for handling SIGCHLD. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 wait_without_blocking ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
403 #endif /* subprocesses */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404 return Qnil;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406
6466
4b3c537e1169 (Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents: 6391
diff changeset
407 /* Enable sending signal if user quits below. */
6275
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
408 call_process_exited = 0;
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
409
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
410 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
411 /* 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
412 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
413 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
414 #else
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 record_unwind_protect (call_process_cleanup,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 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
417 #endif /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 if (XTYPE (buffer) == Lisp_Buffer)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 Fset_buffer (buffer);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423 immediate_quit = 1;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 QUIT;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427 register int nread;
5251
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
428 int first = 1;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429
8853
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
430 while ((nread = read (fd[0], buf, sizeof buf)) != 0)
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 {
8853
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
432 if (nread < 0)
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
433 {
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
434 #if defined (__osf__) && defined (__alpha)
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
435 continue; /* Work around bug in DEC OSF/1 V3.0. */
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
436 #else
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
437 break;
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
438 #endif
f44e40e722b2 (Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents: 8737
diff changeset
439 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 immediate_quit = 0;
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
441 if (!NILP (buffer))
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 insert (buf, nread);
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
443 if (!NILP (display) && INTERACTIVE)
5251
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
444 {
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
445 if (first)
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
446 prepare_menu_bars ();
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
447 first = 0;
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
448 redisplay_preserve_echo_area ();
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
449 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450 immediate_quit = 1;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 QUIT;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
453 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
454
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 /* Wait for it to terminate, unless it already has. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 wait_for_termination (pid);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 immediate_quit = 0;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 set_buffer_internal (old);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461
6275
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
462 /* Don't kill any children that the subprocess may have left behind
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
463 when exiting. */
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
464 call_process_exited = 1;
132464faeaf4 Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents: 6031
diff changeset
465
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466 unbind_to (count, Qnil);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
468 if (synch_process_death)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 return build_string (synch_process_death);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 return make_number (synch_process_retcode);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473
1912
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
474 static Lisp_Object
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 delete_temp_file (name)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 Lisp_Object name;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 {
8737
72b312ebaa10 (delete_temp_file): Use Fdelete_file.
Richard M. Stallman <rms@gnu.org>
parents: 8555
diff changeset
478 /* Use Fdelete_file because that runs a file name handler.
72b312ebaa10 (delete_temp_file): Use Fdelete_file.
Richard M. Stallman <rms@gnu.org>
parents: 8555
diff changeset
479 We did that when writing the file, so we should do so when deleting. */
72b312ebaa10 (delete_temp_file): Use Fdelete_file.
Richard M. Stallman <rms@gnu.org>
parents: 8555
diff changeset
480 Fdelete_file (name);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483 DEFUN ("call-process-region", Fcall_process_region, Scall_process_region,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484 3, MANY, 0,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485 "Send text from START to END to a synchronous process running PROGRAM.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 Delete the text if fourth arg DELETE is non-nil.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 Insert output in BUFFER before point; t means current buffer;\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488 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
489 Sixth arg DISPLAY non-nil means redisplay buffer as output is inserted.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
490 Remaining args are passed to PROGRAM at startup as command args.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491 If BUFFER is nil, returns immediately with value nil.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 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
493 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
494 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
495 (nargs, args)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496 int nargs;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
497 register Lisp_Object *args;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498 {
8555
f1b1537ed3f6 (Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents: 7900
diff changeset
499 struct gcpro gcpro1;
f1b1537ed3f6 (Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents: 7900
diff changeset
500 Lisp_Object filename_string;
f1b1537ed3f6 (Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents: 7900
diff changeset
501 register Lisp_Object start, end;
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
502 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
503 char *tempfile;
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
504 #else
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505 char tempfile[20];
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
506 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507 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
508 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
509 char *outf = '\0';
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
510
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
511 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
512 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
513 else
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
514 {
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
515 tempfile = alloca (20);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
516 *tempfile = '\0';
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
517 }
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
518 dostounix_filename (tempfile);
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
519 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
520 strcat (tempfile, "/");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
521 strcat (tempfile, "detmp.XXX");
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
522 #else /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
523
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
524 #ifdef VMS
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
525 strcpy (tempfile, "tmp:emacsXXXXXX.");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
526 #else
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
527 strcpy (tempfile, "/tmp/emacsXXXXXX");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
528 #endif
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
529 #endif /* not MSDOS */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
530
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531 mktemp (tempfile);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
532
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
533 filename_string = build_string (tempfile);
8555
f1b1537ed3f6 (Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents: 7900
diff changeset
534 GCPRO1 (filename_string);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
535 start = args[0];
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
536 end = args[1];
7397
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
537 #ifdef MSDOS
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
538 specbind (Qbuffer_file_type, Vbinary_process_input);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
539 Fwrite_region (start, end, filename_string, Qnil, Qlambda);
7397
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
540 unbind_to (count, Qnil);
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
541 #else
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
542 Fwrite_region (start, end, filename_string, Qnil, Qlambda);
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
543 #endif
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
544
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
545 record_unwind_protect (delete_temp_file, filename_string);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
546
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
547 if (!NILP (args[3]))
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
548 Fdelete_region (start, end);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
549
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
550 args[3] = filename_string;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
551
8555
f1b1537ed3f6 (Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents: 7900
diff changeset
552 RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs - 2, args + 2)));
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
553 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
554
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
555 #ifndef VMS /* VMS version is in vmsproc.c. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
556
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
557 /* This is the last thing run in a newly forked inferior
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
558 either synchronous or asynchronous.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
559 Copy descriptors IN, OUT and ERR as descriptors 0, 1 and 2.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
560 Initialize inferior's priority, pgrp, connected dir and environment.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
561 then exec another program based on new_argv.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
562
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
563 This function may change environ for the superior process.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
564 Therefore, the superior process must save and restore the value
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
565 of environ around the vfork and the call to this function.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 ENV is the environment for the subprocess.
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_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
570 process group.
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571
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
572 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
573 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
574 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
575 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
576
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
577 child_setup (in, out, err, new_argv, set_pgrp, current_dir)
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 int in, out, err;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 register char **new_argv;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 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
581 Lisp_Object current_dir;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
582 {
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
583 #ifdef MSDOS
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
584 /* 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
585 instead. */
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
586 #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
587 char **env;
7722
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
588 char *pwd_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
589
5530
7ff479a8e8bf (child_setup): Don't declare PID `register'; we later take its address.
Roland McGrath <roland@gnu.org>
parents: 5516
diff changeset
590 int pid = getpid ();
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
591
7481
b7d23c08750c (child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents: 7465
diff changeset
592 #ifdef SET_EMACS_PRIORITY
1201
4ea86d32c012 * callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents: 948
diff changeset
593 {
4ea86d32c012 * callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents: 948
diff changeset
594 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
595
7481
b7d23c08750c (child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents: 7465
diff changeset
596 if (emacs_priority < 0)
b7d23c08750c (child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents: 7465
diff changeset
597 nice (- emacs_priority);
1201
4ea86d32c012 * callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents: 948
diff changeset
598 }
7161
67618cd7bdbf (child_setup): Test PRIO_PROCESS, as in sys_subshell.
Richard M. Stallman <rms@gnu.org>
parents: 7000
diff changeset
599 #endif
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
600
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
601 #ifdef subprocesses
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
602 /* Close Emacs's descriptors that this process should not have. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603 close_process_descs ();
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 #endif
5569
b9e2884ca8e6 (child_setup): Call close_load_descs.
Richard M. Stallman <rms@gnu.org>
parents: 5530
diff changeset
605 close_load_descs ();
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
606
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607 /* 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
608 that do not have true vfork or that have true (stack) alloca.
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609 If using vfork and C_ALLOCA it is safe because that changes
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610 the superior's static variables as if the superior had done alloca
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
611 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
612 {
7722
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
613 register char *temp;
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
614 register int i;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
615
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
616 i = XSTRING (current_dir)->size;
7722
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
617 pwd_var = (char *) alloca (i + 6);
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
618 temp = pwd_var + 4;
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
619 bcopy ("PWD=", pwd_var, 4);
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
620 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
621 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
622 temp[i] = 0;
538
c3e1fe268e78 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 493
diff changeset
623
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
624 /* 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
625 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
626 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
627 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
628 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
629 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
630 exit (errno);
7722
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
631
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
632 /* Strip trailing slashes for PWD, but leave "/" and "//" alone. */
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
633 while (i > 2 && temp[i - 1] == '/')
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
634 temp[--i] = 0;
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
635 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
636
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
637 /* Set `env' to a vector of the strings in Vprocess_environment. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
638 {
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
639 register Lisp_Object tem;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
640 register char **new_env;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
641 register int new_length;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
642
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
643 new_length = 0;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
644 for (tem = Vprocess_environment;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
645 (XTYPE (tem) == Lisp_Cons
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
646 && XTYPE (XCONS (tem)->car) == Lisp_String);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
647 tem = XCONS (tem)->cdr)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
648 new_length++;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
649
7722
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
650 /* new_length + 2 to include PWD and terminating 0. */
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
651 env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *));
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
652
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
653 /* If we have a PWD envvar, pass one down,
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
654 but with corrected value. */
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
655 if (getenv ("PWD"))
e422f06592d3 (child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents: 7481
diff changeset
656 *new_env++ = pwd_var;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
657
2757
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
658 /* Copy the Vprocess_environment strings into new_env. */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
659 for (tem = Vprocess_environment;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
660 (XTYPE (tem) == Lisp_Cons
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
661 && XTYPE (XCONS (tem)->car) == Lisp_String);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
662 tem = XCONS (tem)->cdr)
2757
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
663 {
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
664 char **ep = env;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
665 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
666 /* 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
667 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
668 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
669 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
670 for (; ep != new_env; ep++)
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
671 {
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
672 char *p = *ep, *q = string;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
673 while (1)
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
674 {
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
675 if (*q == 0)
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
676 /* 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
677 goto duplicate;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
678 if (*q != *p)
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
679 break;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
680 if (*q == '=')
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
681 goto duplicate;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
682 p++, q++;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
683 }
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
684 }
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
685 *new_env++ = string;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
686 duplicate: ;
a3ee51f30431 (child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents: 2509
diff changeset
687 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
688 *new_env = 0;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
689 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
690
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
691 /* 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
692 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
693 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
694 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
695 in = relocate_fd (in, 3);
6614
e095c5efe2e0 (child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents: 6495
diff changeset
696 if (out == err)
e095c5efe2e0 (child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents: 6495
diff changeset
697 err = out = relocate_fd (out, 3);
e095c5efe2e0 (child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents: 6495
diff changeset
698 else
e095c5efe2e0 (child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents: 6495
diff changeset
699 {
e095c5efe2e0 (child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents: 6495
diff changeset
700 out = relocate_fd (out, 3);
e095c5efe2e0 (child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents: 6495
diff changeset
701 err = relocate_fd (err, 3);
e095c5efe2e0 (child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents: 6495
diff changeset
702 }
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
703
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
704 close (0);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
705 close (1);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
706 close (2);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
707
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
708 dup2 (in, 0);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
709 dup2 (out, 1);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
710 dup2 (err, 2);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
711 close (in);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
712 close (out);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
713 close (err);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
714
5179
2a1492764d5e (child_setup): Test SETPGRP_RELEASES_CTTY, not IRIX.
Richard M. Stallman <rms@gnu.org>
parents: 5154
diff changeset
715 #ifdef USG
2a1492764d5e (child_setup): Test SETPGRP_RELEASES_CTTY, not IRIX.
Richard M. Stallman <rms@gnu.org>
parents: 5154
diff changeset
716 #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
717 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
718 #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
719 #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
720 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
721 #endif /* USG */
5348
f921e3c48dcb Include systty.h.
Richard M. Stallman <rms@gnu.org>
parents: 5251
diff changeset
722 /* setpgrp_of_tty is incorrect here; it uses input_fd. */
f921e3c48dcb Include systty.h.
Richard M. Stallman <rms@gnu.org>
parents: 5251
diff changeset
723 EMACS_SET_TTY_PGRP (0, &pid);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
724
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
725 #ifdef vipc
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
726 something missing here;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
727 #endif /* vipc */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
728
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
729 /* execvp does not accept an environment arg so the only way
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
730 to pass this environment is to set environ. Our caller
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
731 is responsible for restoring the ambient value of environ. */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
732 environ = env;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
733 execvp (new_argv[0], new_argv);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
734
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
735 write (1, "Couldn't exec the program ", 26);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
736 write (1, new_argv[0], strlen (new_argv[0]));
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
737 _exit (1);
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
738 #endif /* not MSDOS */
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
739 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
740
2286
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
741 /* 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
742 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
743 int
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
744 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
745 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
746 {
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
747 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
748 return fd;
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
749 else
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
750 {
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
751 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
752 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
753 {
2509
daaa78c8c980 * callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents: 2432
diff changeset
754 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
755 char *errmessage = strerror (errno);
2509
daaa78c8c980 * callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents: 2432
diff changeset
756 char *message2 = "\n";
daaa78c8c980 * callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents: 2432
diff changeset
757 write (2, message1, strlen (message1));
5516
ec5a245c14ed Don't declare sys_errlist; declare strerror instead.
Roland McGrath <roland@gnu.org>
parents: 5501
diff changeset
758 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
759 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
760 _exit (1);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
761 }
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
762 /* 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
763 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
764 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
765 close (fd);
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
766 return new;
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
767 }
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
768 }
7f66b40a0192 * callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents: 1912
diff changeset
769
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
770 static int
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
771 getenv_internal (var, varlen, value, valuelen)
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
772 char *var;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
773 int varlen;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
774 char **value;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
775 int *valuelen;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
776 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
777 Lisp_Object scan;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
778
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
779 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
780 {
6495
c88f34090aea (call_process_cleanup, getenv_internal): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents: 6466
diff changeset
781 Lisp_Object entry;
c88f34090aea (call_process_cleanup, getenv_internal): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents: 6466
diff changeset
782
c88f34090aea (call_process_cleanup, getenv_internal): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents: 6466
diff changeset
783 entry = XCONS (scan)->car;
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
784 if (XTYPE (entry) == Lisp_String
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
785 && XSTRING (entry)->size > varlen
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
786 && XSTRING (entry)->data[varlen] == '='
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
787 && ! bcmp (XSTRING (entry)->data, var, varlen))
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
788 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
789 *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
790 *valuelen = XSTRING (entry)->size - (varlen + 1);
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
791 return 1;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
792 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
793 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
794
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
795 return 0;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
796 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
797
5251
480731ff8e9a (Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents: 5179
diff changeset
798 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
799 "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
800 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
801 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
802 (var)
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
803 Lisp_Object var;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
804 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
805 char *value;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
806 int valuelen;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
807
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
808 CHECK_STRING (var, 0);
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
809 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
810 &value, &valuelen))
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
811 return make_string (value, valuelen);
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
812 else
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
813 return Qnil;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
814 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
815
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
816 /* 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
817 callable from C. */
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
818 char *
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
819 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
820 char *var;
942
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
821 {
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
822 char *value;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
823 int valuelen;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
824
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
825 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
826 return value;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
827 else
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
828 return 0;
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
829 }
c519b70eb50b Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents: 934
diff changeset
830
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
831 #endif /* not VMS */
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
832
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
833 /* 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
834
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
835 init_callproc_1 ()
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
836 {
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
837 char *data_dir = egetenv ("EMACSDATA");
6031
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
838 char *doc_dir = egetenv ("EMACSDOC");
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
839
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
840 Vdata_directory
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
841 = 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
842 : PATH_DATA));
6031
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
843 Vdoc_directory
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
844 = 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
845 : 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
846
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
847 /* 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
848 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
849 Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
850 Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path));
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
851 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
852 }
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
853
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
854 /* 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
855
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
856 init_callproc ()
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
857 {
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
858 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
859
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
860 register char * sh;
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
861 Lisp_Object tempdir;
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
862
5618
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
863 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
864 {
5618
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
865 /* 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
866 Lisp_Object tem;
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
867 tem = Fexpand_file_name (build_string ("lib-src"),
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
868 Vinstallation_directory);
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
869 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
870 {
7824
de1dfb8aea82 (init_callproc) [MSDOS]: Exclude less code, so ../etc
Richard M. Stallman <rms@gnu.org>
parents: 7782
diff changeset
871 #ifndef MSDOS
de1dfb8aea82 (init_callproc) [MSDOS]: Exclude less code, so ../etc
Richard M. Stallman <rms@gnu.org>
parents: 7782
diff changeset
872 /* MSDOS uses wrapped binaries, so don't do this. */
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
873 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
874 Vexec_directory = Ffile_name_as_directory (tem);
7824
de1dfb8aea82 (init_callproc) [MSDOS]: Exclude less code, so ../etc
Richard M. Stallman <rms@gnu.org>
parents: 7782
diff changeset
875 #endif
5154
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
876
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
877 /* 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
878 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
879 if (data_dir == 0)
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
880 {
5618
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
881 tem = Fexpand_file_name (build_string ("etc"),
a70dc7c886d0 (init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents: 5569
diff changeset
882 Vinstallation_directory);
7465
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
883 Vdoc_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
884 }
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
885 }
e4e66bcaa016 (init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents: 4977
diff changeset
886 }
7465
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
887
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
888 /* Look for the files that should be in etc. We don't use
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
889 Vinstallation_directory, because these files are never installed
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
890 in /bin near the executable, and they are never in the build
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
891 directory when that's different from the source directory.
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
892
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
893 Instead, if these files are not in the nominal place, we try the
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
894 source directory. */
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
895 if (data_dir == 0)
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
896 {
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
897 Lisp_Object tem, tem1, newdir;
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
898
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
899 tem = Fexpand_file_name (build_string ("GNU"), Vdata_directory);
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
900 tem1 = Ffile_exists_p (tem);
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
901 if (NILP (tem1))
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
902 {
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
903 newdir = Fexpand_file_name (build_string ("../etc/"),
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
904 build_string (PATH_DUMPLOADSEARCH));
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
905 tem = Fexpand_file_name (build_string ("GNU"), newdir);
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
906 tem1 = Ffile_exists_p (tem);
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
907 if (!NILP (tem1))
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
908 Vdata_directory = newdir;
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
909 }
fccf9d4df7bb (init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents: 7397
diff changeset
910 }
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911
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
912 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
913 if (access (XSTRING (tempdir)->data, 0) < 0)
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914 {
5688
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
915 fprintf (stderr,
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
916 "Warning: arch-dependent data dir (%s) does not exist.\n",
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
917 XSTRING (Vexec_directory)->data);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
918 sleep (2);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
919 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
920
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
921 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
922 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
923 {
5688
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
924 fprintf (stderr,
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
925 "Warning: arch-independent data dir (%s) does not exist.\n",
a0f01b43a459 Include stdio.h.
Richard M. Stallman <rms@gnu.org>
parents: 5618
diff changeset
926 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
927 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
928 }
928ed74adf4f Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents: 942
diff changeset
929
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
930 #ifdef VMS
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
931 Vshell_file_name = build_string ("*dcl*");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
932 #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
933 sh = (char *) getenv ("SHELL");
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 Vshell_file_name = build_string (sh ? sh : "/bin/sh");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935 #endif
1912
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
936 }
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
937
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
938 set_process_environment ()
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
939 {
f0d4fb2b9157 * callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents: 1886
diff changeset
940 register char **envp;
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
941
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
942 Vprocess_environment = Qnil;
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
943 #ifndef CANNOT_DUMP
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
944 if (initialized)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
945 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
946 for (envp = environ; *envp; envp++)
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 Vprocess_environment = Fcons (build_string (*envp),
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948 Vprocess_environment);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 }
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
950
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
951 syms_of_callproc ()
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 {
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
953 #ifdef MSDOS
7397
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
954 Qbuffer_file_type = intern ("buffer-file-type");
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
955 staticpro (&Qbuffer_file_type);
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
956
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
957 DEFVAR_LISP ("binary-process-input", &Vbinary_process_input,
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
958 "*If non-nil then new subprocesses are assumed to take binary input.");
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
959 Vbinary_process_input = Qnil;
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
960
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
961 DEFVAR_LISP ("binary-process-output", &Vbinary_process_output,
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
962 "*If non-nil then new subprocesses are assumed to produce binary output.");
7397
e0ffa47f2ed4 [MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents: 7161
diff changeset
963 Vbinary_process_output = Qnil;
5501
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
964 #endif
902cd7024cfa (syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents: 5348
diff changeset
965
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
966 DEFVAR_LISP ("shell-file-name", &Vshell_file_name,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
967 "*File name to load inferior shells from.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
968 Initialized from the SHELL environment variable.");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
969
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
970 DEFVAR_LISP ("exec-path", &Vexec_path,
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 "*List of directories to search programs to run in subprocesses.\n\
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
972 Each element is a string (directory name) or nil (try default directory).");
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 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
975 "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
976 especially executable programs intended for Emacs to invoke.");
439
350065270fc8 *** empty log message ***
Jim Blandy <jimb@redhat.com>
parents: 311
diff changeset
977
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
978 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
979 "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
980 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
981
6031
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
982 DEFVAR_LISP ("doc-directory", &Vdoc_directory,
ae4c6623837b (syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents: 5688
diff changeset
983 "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
984 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
985
3064
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
986 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
987 "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
988 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
989 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
990 includes this.");
fa5466904709 * paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents: 2961
diff changeset
991 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
992
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993 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
994 "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
995 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
996 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
997 when Emacs starts.");
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
998
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
999 #ifndef VMS
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000 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
1001 defsubr (&Sgetenv);
296
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 #endif
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003 defsubr (&Scall_process_region);
558b874b5259 Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 }