Mercurial > emacs
annotate src/callproc.c @ 26877:9c5071c954cd
(lisp_data_to_selection_data): Adjusted for the change
for find_charset_in_str.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Wed, 15 Dec 1999 00:26:05 +0000 |
parents | 27b6d3367b47 |
children | 45b919961573 |
rev | line source |
---|---|
296 | 1 /* Synchronous subprocess invocation for GNU Emacs. |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
2 Copyright (C) 1985, 86,87,88,93,94,95, 1999 Free Software Foundation, Inc. |
296 | 3 |
4 This file is part of GNU Emacs. | |
5 | |
6 GNU Emacs is free software; you can redistribute it and/or modify | |
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 | 9 any later version. |
10 | |
11 GNU Emacs is distributed in the hope that it will be useful, | |
12 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 GNU General Public License for more details. | |
15 | |
16 You should have received a copy of the GNU General Public License | |
17 along with GNU Emacs; see the file COPYING. If not, write to | |
14186
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
ee40177f6c68
Update FSF's address in the preamble.
Erik Naggum <erik@naggum.no>
parents:
14036
diff
changeset
|
19 Boston, MA 02111-1307, USA. */ |
296 | 20 |
21 | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
22 #include <config.h> |
296 | 23 #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
|
24 #include <errno.h> |
7900
60795e826dad
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7824
diff
changeset
|
25 #include <stdio.h> |
296 | 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; |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
28 |
296 | 29 /* Define SIGCHLD as an alias for SIGCLD. */ |
30 | |
31 #if !defined (SIGCHLD) && defined (SIGCLD) | |
32 #define SIGCHLD SIGCLD | |
33 #endif /* SIGCLD */ | |
34 | |
35 #include <sys/types.h> | |
3932
9a411d86ca72
(PRIO_PROCESS): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
3826
diff
changeset
|
36 |
25767
30ffae737755
(toplevel) [HAVE_UNISTD_H]: Include unistd.h.
Gerd Moellmann <gerd@gnu.org>
parents:
25645
diff
changeset
|
37 #ifdef HAVE_UNISTD_H |
30ffae737755
(toplevel) [HAVE_UNISTD_H]: Include unistd.h.
Gerd Moellmann <gerd@gnu.org>
parents:
25645
diff
changeset
|
38 #include <unistd.h> |
30ffae737755
(toplevel) [HAVE_UNISTD_H]: Include unistd.h.
Gerd Moellmann <gerd@gnu.org>
parents:
25645
diff
changeset
|
39 #endif |
30ffae737755
(toplevel) [HAVE_UNISTD_H]: Include unistd.h.
Gerd Moellmann <gerd@gnu.org>
parents:
25645
diff
changeset
|
40 |
296 | 41 #include <sys/file.h> |
42 #ifdef USG5 | |
6818
6a9b0b5399ce
If we include fcntl.h, define INCLUDED_FCNTL.
Richard M. Stallman <rms@gnu.org>
parents:
6614
diff
changeset
|
43 #define INCLUDED_FCNTL |
296 | 44 #include <fcntl.h> |
45 #endif | |
46 | |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
47 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
48 #define NOMINMAX |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
49 #include <windows.h> |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
50 #include <stdlib.h> /* for proper declaration of environ */ |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
51 #include <fcntl.h> |
16593
4ed80eda6fac
Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents:
16486
diff
changeset
|
52 #include "w32.h" |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
53 #define _P_NOWAIT 1 /* from process.h */ |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
54 #endif |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
55 |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
56 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ |
6818
6a9b0b5399ce
If we include fcntl.h, define INCLUDED_FCNTL.
Richard M. Stallman <rms@gnu.org>
parents:
6614
diff
changeset
|
57 #define INCLUDED_FCNTL |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
58 #include <fcntl.h> |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
59 #include <sys/stat.h> |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
60 #include <sys/param.h> |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
61 #include <errno.h> |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
62 #endif /* MSDOS */ |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
63 |
296 | 64 #ifndef O_RDONLY |
65 #define O_RDONLY 0 | |
66 #endif | |
67 | |
68 #ifndef O_WRONLY | |
69 #define O_WRONLY 1 | |
70 #endif | |
71 | |
72 #include "lisp.h" | |
73 #include "commands.h" | |
74 #include "buffer.h" | |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
75 #include "charset.h" |
23885 | 76 #include "ccl.h" |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
77 #include "coding.h" |
24412
d11ac02f9d6a
Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents:
23885
diff
changeset
|
78 #include <epaths.h> |
296 | 79 #include "process.h" |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
80 #include "syssignal.h" |
5348 | 81 #include "systty.h" |
296 | 82 |
21786
5f8f1b124f45
nclude msdos.h after lisp.h.
Eli Zaretskii <eliz@gnu.org>
parents:
21694
diff
changeset
|
83 #ifdef MSDOS |
5f8f1b124f45
nclude msdos.h after lisp.h.
Eli Zaretskii <eliz@gnu.org>
parents:
21694
diff
changeset
|
84 #include "msdos.h" |
5f8f1b124f45
nclude msdos.h after lisp.h.
Eli Zaretskii <eliz@gnu.org>
parents:
21694
diff
changeset
|
85 #endif |
5f8f1b124f45
nclude msdos.h after lisp.h.
Eli Zaretskii <eliz@gnu.org>
parents:
21694
diff
changeset
|
86 |
296 | 87 #ifdef VMS |
88 extern noshare char **environ; | |
89 #else | |
90 extern char **environ; | |
91 #endif | |
92 | |
93 #define max(a, b) ((a) > (b) ? (a) : (b)) | |
94 | |
6031
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
95 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
|
96 Lisp_Object Vconfigure_info_directory; |
16627
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
97 Lisp_Object Vtemp_file_name_pattern; |
296 | 98 |
99 Lisp_Object Vshell_file_name; | |
100 | |
101 Lisp_Object Vprocess_environment; | |
102 | |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
103 #ifdef DOS_NT |
7397
e0ffa47f2ed4
[MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents:
7161
diff
changeset
|
104 Lisp_Object Qbuffer_file_type; |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
105 #endif /* DOS_NT */ |
7397
e0ffa47f2ed4
[MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents:
7161
diff
changeset
|
106 |
296 | 107 /* True iff we are about to fork off a synchronous process or if we |
108 are waiting for it. */ | |
109 int synch_process_alive; | |
110 | |
111 /* Nonzero => this is a string explaining death of synchronous subprocess. */ | |
112 char *synch_process_death; | |
113 | |
114 /* If synch_process_death is zero, | |
115 this is exit code of synchronous subprocess. */ | |
116 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
|
117 |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
118 extern Lisp_Object Vdoc_file_name; |
19838
7e1bbe58eb02
(Fcall_process): Encode the new current dir.
Richard M. Stallman <rms@gnu.org>
parents:
19790
diff
changeset
|
119 |
21053
77d489dd420a
(Vdefault_file_name_coding_system): Extern it.
Kenichi Handa <handa@m17n.org>
parents:
21036
diff
changeset
|
120 extern Lisp_Object Vfile_name_coding_system, Vdefault_file_name_coding_system; |
296 | 121 |
6275
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
122 /* 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
|
123 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
|
124 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
|
125 |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
126 /* 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
|
127 static int call_process_exited; |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
128 |
296 | 129 #ifndef VMS /* VMS version is in vmsproc.c. */ |
130 | |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
131 static Lisp_Object |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
132 call_process_kill (fdpid) |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
133 Lisp_Object fdpid; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
134 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
135 emacs_close (XFASTINT (Fcar (fdpid))); |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
136 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
|
137 synch_process_alive = 0; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
138 return Qnil; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
139 } |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
140 |
296 | 141 Lisp_Object |
142 call_process_cleanup (fdpid) | |
143 Lisp_Object fdpid; | |
144 { | |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
145 #if defined (MSDOS) || defined (macintosh) |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
146 /* 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
|
147 register Lisp_Object file; |
c88f34090aea
(call_process_cleanup, getenv_internal): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6466
diff
changeset
|
148 file = Fcdr (fdpid); |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
149 emacs_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
|
150 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
|
151 unlink (XSTRING (file)->data); |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
152 #else /* not MSDOS and not macintosh */ |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
153 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
|
154 |
6275
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
155 if (call_process_exited) |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
156 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
157 emacs_close (XFASTINT (Fcar (fdpid))); |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
158 return Qnil; |
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
159 } |
6275
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
160 |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
161 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
|
162 { |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
163 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
|
164 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
|
165 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
|
166 immediate_quit = 1; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
167 QUIT; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
168 wait_for_termination (pid); |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
169 immediate_quit = 0; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
170 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
|
171 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
|
172 } |
296 | 173 synch_process_alive = 0; |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
174 emacs_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
|
175 #endif /* not MSDOS */ |
296 | 176 return Qnil; |
177 } | |
178 | |
179 DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0, | |
180 "Call PROGRAM synchronously in separate process.\n\ | |
23885 | 181 The remaining arguments are optional.\n\ |
296 | 182 The program's input comes from file INFILE (nil means `/dev/null').\n\ |
183 Insert output in BUFFER before point; t means current buffer;\n\ | |
184 nil for BUFFER means discard it; 0 means discard and don't wait.\n\ | |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
185 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
186 REAL-BUFFER says what to do with standard output, as above,\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
187 while STDERR-FILE says what to do with standard error in the child.\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
188 STDERR-FILE may be nil (discard standard error output),\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
189 t (mix it with ordinary output), or a file name string.\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
190 \n\ |
296 | 191 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.\n\ |
192 Remaining arguments are strings passed as command arguments to PROGRAM.\n\ | |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
193 \n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
194 If BUFFER is 0, `call-process' returns immediately with value nil.\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
195 Otherwise it 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
|
196 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
|
197 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") |
296 | 198 (nargs, args) |
199 int nargs; | |
200 register Lisp_Object *args; | |
201 { | |
1678
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
202 Lisp_Object infile, buffer, current_dir, display, path; |
296 | 203 int fd[2]; |
204 int filefd; | |
205 register int pid; | |
11619
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
206 char buf[16384]; |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
207 char *bufptr = buf; |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
208 int bufsize = 16384; |
296 | 209 int count = specpdl_ptr - specpdl; |
20525
468f59c6c9bf
(Fcall_process): Cast new_argv for child_setup.
Richard M. Stallman <rms@gnu.org>
parents:
20448
diff
changeset
|
210 |
296 | 211 register unsigned char **new_argv |
212 = (unsigned char **) alloca ((max (2, nargs - 2)) * sizeof (char *)); | |
213 struct buffer *old = current_buffer; | |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
214 /* File to use for stderr in the child. |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
215 t means use same as standard output. */ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
216 Lisp_Object error_file; |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
217 #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
|
218 char *outf, *tempfile; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
219 int outfilefd; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
220 #endif |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
221 #ifdef macintosh |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
222 char *tempfile; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
223 int outfilefd; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
224 #endif |
296 | 225 #if 0 |
226 int mask; | |
227 #endif | |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
228 struct coding_system process_coding; /* coding-system of process output */ |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
229 struct coding_system argument_coding; /* coding-system of arguments */ |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
230 /* Set to the return value of Ffind_operation_coding_system. */ |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
231 Lisp_Object coding_systems; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
232 |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
233 /* Qt denotes that Ffind_operation_coding_system is not yet called. */ |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
234 coding_systems = Qt; |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
235 |
296 | 236 CHECK_STRING (args[0], 0); |
237 | |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
238 error_file = Qt; |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
239 |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
240 #ifndef subprocesses |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
241 /* Without asynchronous processes we cannot have BUFFER == 0. */ |
22550
4ec5c343db1f
(Fcall_process): Handle third argument BUFFER
Richard M. Stallman <rms@gnu.org>
parents:
22373
diff
changeset
|
242 if (nargs >= 3 |
22639
8177901b437a
(Fcall_process) [! subprocesses]: Balance parentheses in an if clause.
Eli Zaretskii <eliz@gnu.org>
parents:
22550
diff
changeset
|
243 && (INTEGERP (CONSP (args[2]) ? XCAR (args[2]) : args[2]))) |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
244 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
|
245 #endif /* subprocesses */ |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
246 |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
247 /* Decide the coding-system for giving arguments. */ |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
248 { |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
249 Lisp_Object val, *args2; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
250 int i; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
251 |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
252 /* If arguments are supplied, we may have to encode them. */ |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
253 if (nargs >= 5) |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
254 { |
20595
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
255 int must_encode = 0; |
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
256 |
20789
140b6fdd53d0
(Fcall_process): Test only args past args[4] for multibyteness.
Richard M. Stallman <rms@gnu.org>
parents:
20724
diff
changeset
|
257 for (i = 4; i < nargs; i++) |
22940
3cfe86230c87
(Fcall_process): Check type of process cmd args earlier on.
Richard M. Stallman <rms@gnu.org>
parents:
22792
diff
changeset
|
258 CHECK_STRING (args[i], i); |
3cfe86230c87
(Fcall_process): Check type of process cmd args earlier on.
Richard M. Stallman <rms@gnu.org>
parents:
22792
diff
changeset
|
259 |
3cfe86230c87
(Fcall_process): Check type of process cmd args earlier on.
Richard M. Stallman <rms@gnu.org>
parents:
22792
diff
changeset
|
260 for (i = 4; i < nargs; i++) |
20595
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
261 if (STRING_MULTIBYTE (args[i])) |
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
262 must_encode = 1; |
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
263 |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
264 if (!NILP (Vcoding_system_for_write)) |
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
265 val = Vcoding_system_for_write; |
20595
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
266 else if (! must_encode) |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
267 val = Qnil; |
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
268 else |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
269 { |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
270 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
271 args2[0] = Qcall_process; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
272 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; |
18539
8c13c54d52c8
Call Ffind_operation_coding_system.
Kenichi Handa <handa@m17n.org>
parents:
18494
diff
changeset
|
273 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); |
18182
967f92654591
(Fcall_process): Pay attention to
Kenichi Handa <handa@m17n.org>
parents:
17729
diff
changeset
|
274 if (CONSP (coding_systems)) |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
275 val = XCDR (coding_systems); |
18182
967f92654591
(Fcall_process): Pay attention to
Kenichi Handa <handa@m17n.org>
parents:
17729
diff
changeset
|
276 else if (CONSP (Vdefault_process_coding_system)) |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
277 val = XCDR (Vdefault_process_coding_system); |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
278 else |
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
279 val = Qnil; |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
280 } |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
281 setup_coding_system (Fcheck_coding_system (val), &argument_coding); |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
282 } |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
283 } |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
284 |
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
|
285 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
|
286 { |
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
287 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
|
288 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
|
289 } |
296 | 290 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
|
291 infile = build_string (NULL_DEVICE); |
648 | 292 |
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
|
293 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
|
294 { |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
295 buffer = args[2]; |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
296 |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
297 /* If BUFFER is a list, its meaning is |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
298 (BUFFER-FOR-STDOUT FILE-FOR-STDERR). */ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
299 if (CONSP (buffer)) |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
300 { |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
301 if (CONSP (XCDR (buffer))) |
15440
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
302 { |
15473
cdf40972804f
(Fcall_process): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
15440
diff
changeset
|
303 Lisp_Object stderr_file; |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
304 stderr_file = XCAR (XCDR (buffer)); |
15440
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
305 |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
306 if (NILP (stderr_file) || EQ (Qt, stderr_file)) |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
307 error_file = stderr_file; |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
308 else |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
309 error_file = Fexpand_file_name (stderr_file, Qnil); |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
310 } |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
311 |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
312 buffer = XCAR (buffer); |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
313 } |
296 | 314 |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
315 if (!(EQ (buffer, Qnil) |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
316 || EQ (buffer, Qt) |
22550
4ec5c343db1f
(Fcall_process): Handle third argument BUFFER
Richard M. Stallman <rms@gnu.org>
parents:
22373
diff
changeset
|
317 || INTEGERP (buffer))) |
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
|
318 { |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
319 Lisp_Object spec_buffer; |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
320 spec_buffer = buffer; |
20823
146647357199
(Fcall_process): Allow creating a new buffer for the output.
Richard M. Stallman <rms@gnu.org>
parents:
20789
diff
changeset
|
321 buffer = Fget_buffer_create (buffer); |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
322 /* Mention the buffer name for a better error message. */ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
323 if (NILP (buffer)) |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
324 CHECK_BUFFER (spec_buffer, 2); |
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
|
325 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
|
326 } |
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
327 } |
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
328 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
|
329 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
|
330 |
1678
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
331 /* 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
|
332 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
|
333 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
|
334 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
|
335 |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
336 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
|
337 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
|
338 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
|
339 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
|
340 buffer. */ |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
341 { |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
342 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
|
343 |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
344 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
|
345 |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
346 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
|
347 |
6391
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
348 current_dir |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
349 = 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
|
350 Qnil); |
1678
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
351 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
|
352 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
|
353 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
|
354 |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
355 UNGCPRO; |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
356 } |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
357 |
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
|
358 display = nargs >= 4 ? args[3] : Qnil; |
296 | 359 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
360 filefd = emacs_open (XSTRING (infile)->data, O_RDONLY, 0); |
6391
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
361 if (filefd < 0) |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
362 { |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
363 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
|
364 } |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
365 /* Search for program; barf if not found. */ |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
366 { |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
367 struct gcpro gcpro1; |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
368 |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
369 GCPRO1 (current_dir); |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
370 openp (Vexec_path, args[0], EXEC_SUFFIXES, &path, 1); |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
371 UNGCPRO; |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
372 } |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
373 if (NILP (path)) |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
374 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
375 emacs_close (filefd); |
6391
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
376 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
|
377 } |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
378 new_argv[0] = XSTRING (path)->data; |
20230
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
379 if (nargs > 4) |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
380 { |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
381 register int i; |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
382 |
26838
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
383 if (CODING_REQUIRE_ENCODING (&argument_coding)) |
20230
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
384 { |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
385 /* We must encode the arguments. */ |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
386 struct gcpro gcpro1, gcpro2, gcpro3; |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
387 |
20230
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
388 GCPRO3 (infile, buffer, current_dir); |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
389 for (i = 4; i < nargs; i++) |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
390 { |
26838
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
391 args[i] = code_convert_string (args[i], &argument_coding, 1, 0); |
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
392 setup_ccl_program (&(argument_coding.spec.ccl.encoder), Qnil); |
20230
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
393 } |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
394 UNGCPRO; |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
395 } |
26838
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
396 for (i = 4; i < nargs; i++) |
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
397 new_argv[i - 3] = XSTRING (args[i])->data; |
20448
afef187a070b
(Fcall_process): Don't clobber new_argv[0]
Karl Heuer <kwzh@gnu.org>
parents:
20436
diff
changeset
|
398 new_argv[nargs - 3] = 0; |
20230
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
399 } |
20448
afef187a070b
(Fcall_process): Don't clobber new_argv[0]
Karl Heuer <kwzh@gnu.org>
parents:
20436
diff
changeset
|
400 else |
afef187a070b
(Fcall_process): Don't clobber new_argv[0]
Karl Heuer <kwzh@gnu.org>
parents:
20436
diff
changeset
|
401 new_argv[1] = 0; |
296 | 402 |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
403 #ifdef MSDOS /* MW, July 1993 */ |
23462
aaad8461ff34
(Fcall_process): Use $TMPDIR instead of trying $TMP
Eli Zaretskii <eliz@gnu.org>
parents:
23079
diff
changeset
|
404 if ((outf = egetenv ("TMPDIR"))) |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
405 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
|
406 else |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
407 { |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
408 tempfile = alloca (20); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
409 *tempfile = '\0'; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
410 } |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
411 dostounix_filename (tempfile); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
412 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
|
413 strcat (tempfile, "/"); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
414 strcat (tempfile, "detmp.XXX"); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
415 mktemp (tempfile); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
416 |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
417 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
|
418 if (outfilefd < 0) |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
419 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
420 emacs_close (filefd); |
15610 | 421 report_file_error ("Opening process output file", |
422 Fcons (build_string (tempfile), Qnil)); | |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
423 } |
15610 | 424 fd[0] = filefd; |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
425 fd[1] = outfilefd; |
15610 | 426 #endif /* MSDOS */ |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
427 |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
428 #ifdef macintosh |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
429 /* Since we don't have pipes on the Mac, create a temporary file to |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
430 hold the output of the subprocess. */ |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
431 tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
432 bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile, |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
433 STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
434 |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
435 mktemp (tempfile); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
436 |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
437 outfilefd = creat (tempfile, S_IREAD | S_IWRITE); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
438 if (outfilefd < 0) |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
439 { |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
440 close (filefd); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
441 report_file_error ("Opening process output file", |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
442 Fcons (build_string (tempfile), Qnil)); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
443 } |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
444 fd[0] = filefd; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
445 fd[1] = outfilefd; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
446 #endif /* macintosh */ |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
447 |
9138
6c814eb4d892
(Fcall_process, child_setup, getenv_internal): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8853
diff
changeset
|
448 if (INTEGERP (buffer)) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
449 fd[1] = emacs_open (NULL_DEVICE, O_WRONLY, 0), fd[0] = -1; |
296 | 450 else |
451 { | |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
452 #ifndef MSDOS |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
453 #ifndef macintosh |
296 | 454 pipe (fd); |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
455 #endif |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
456 #endif |
296 | 457 #if 0 |
458 /* Replaced by close_process_descs */ | |
459 set_exclusive_use (fd[0]); | |
460 #endif | |
461 } | |
462 | |
463 { | |
464 /* child_setup must clobber environ in systems with true vfork. | |
465 Protect it from permanent change. */ | |
466 register char **save_environ = environ; | |
467 register int fd1 = fd[1]; | |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
468 int fd_error = fd1; |
296 | 469 |
470 #if 0 /* Some systems don't have sigblock. */ | |
638 | 471 mask = sigblock (sigmask (SIGCHLD)); |
296 | 472 #endif |
473 | |
474 /* Record that we're about to create a synchronous process. */ | |
475 synch_process_alive = 1; | |
476 | |
4977
81c44a01ddda
(Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents:
4701
diff
changeset
|
477 /* 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
|
478 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
|
479 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
|
480 synch_process_death = 0; |
81c44a01ddda
(Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents:
4701
diff
changeset
|
481 synch_process_retcode = 0; |
81c44a01ddda
(Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents:
4701
diff
changeset
|
482 |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
483 if (NILP (error_file)) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
484 fd_error = emacs_open (NULL_DEVICE, O_WRONLY, 0); |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
485 else if (STRINGP (error_file)) |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
486 { |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
487 #ifdef DOS_NT |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
488 fd_error = emacs_open (XSTRING (error_file)->data, |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
489 O_WRONLY | O_TRUNC | O_CREAT | O_TEXT, |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
490 S_IREAD | S_IWRITE); |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
491 #else /* not DOS_NT */ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
492 fd_error = creat (XSTRING (error_file)->data, 0666); |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
493 #endif /* not DOS_NT */ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
494 } |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
495 |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
496 if (fd_error < 0) |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
497 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
498 emacs_close (filefd); |
15610 | 499 if (fd[0] != filefd) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
500 emacs_close (fd[0]); |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
501 if (fd1 >= 0) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
502 emacs_close (fd1); |
15610 | 503 #ifdef MSDOS |
504 unlink (tempfile); | |
505 #endif | |
506 report_file_error ("Cannot redirect stderr", | |
507 Fcons ((NILP (error_file) | |
508 ? build_string (NULL_DEVICE) : error_file), | |
509 Qnil)); | |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
510 } |
19838
7e1bbe58eb02
(Fcall_process): Encode the new current dir.
Richard M. Stallman <rms@gnu.org>
parents:
19790
diff
changeset
|
511 |
21053
77d489dd420a
(Vdefault_file_name_coding_system): Extern it.
Kenichi Handa <handa@m17n.org>
parents:
21036
diff
changeset
|
512 current_dir = ENCODE_FILE (current_dir); |
19838
7e1bbe58eb02
(Fcall_process): Encode the new current dir.
Richard M. Stallman <rms@gnu.org>
parents:
19790
diff
changeset
|
513 |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
514 #ifdef macintosh |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
515 { |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
516 /* Call run_mac_command in sysdep.c here directly instead of doing |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
517 a child_setup as for MSDOS and other platforms. Note that this |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
518 code does not handle passing the environment to the synchronous |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
519 Mac subprocess. */ |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
520 char *infn, *outfn, *errfn, *currdn; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
521 |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
522 /* close these files so subprocess can write to them */ |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
523 close (outfilefd); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
524 if (fd_error != outfilefd) |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
525 close (fd_error); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
526 fd1 = -1; /* No harm in closing that one! */ |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
527 |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
528 infn = XSTRING (infile)->data; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
529 outfn = tempfile; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
530 if (NILP (error_file)) |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
531 errfn = NULL_DEVICE; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
532 else if (EQ (Qt, error_file)) |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
533 errfn = outfn; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
534 else |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
535 errfn = XSTRING (error_file)->data; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
536 currdn = XSTRING (current_dir)->data; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
537 pid = run_mac_command (new_argv, currdn, infn, outfn, errfn); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
538 |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
539 /* Record that the synchronous process exited and note its |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
540 termination status. */ |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
541 synch_process_alive = 0; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
542 synch_process_retcode = pid; |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
543 if (synch_process_retcode < 0) /* means it couldn't be exec'ed */ |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
544 { |
26526
b7438760079b
* callproc.c (strerror): Remove decl.
Paul Eggert <eggert@twinsun.com>
parents:
26088
diff
changeset
|
545 synchronize_system_messages_locale (); |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
546 synch_process_death = strerror (errno); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
547 } |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
548 |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
549 /* Since CRLF is converted to LF within `decode_coding', we can |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
550 always open a file with binary mode. */ |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
551 fd[0] = open (tempfile, O_BINARY); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
552 if (fd[0] < 0) |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
553 { |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
554 unlink (tempfile); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
555 close (filefd); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
556 report_file_error ("Cannot re-open temporary file", Qnil); |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
557 } |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
558 } |
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
559 #else /* not macintosh */ |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
560 #ifdef MSDOS /* MW, July 1993 */ |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
561 /* Note that on MSDOS `child_setup' actually returns the child process |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
562 exit status, not its PID, so we assign it to `synch_process_retcode' |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
563 below. */ |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
564 pid = child_setup (filefd, outfilefd, fd_error, (char **) new_argv, |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
565 0, current_dir); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
566 |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
567 /* Record that the synchronous process exited and note its |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
568 termination status. */ |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
569 synch_process_alive = 0; |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
570 synch_process_retcode = pid; |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
571 if (synch_process_retcode < 0) /* means it couldn't be exec'ed */ |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
572 { |
26526
b7438760079b
* callproc.c (strerror): Remove decl.
Paul Eggert <eggert@twinsun.com>
parents:
26088
diff
changeset
|
573 synchronize_system_messages_locale (); |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
574 synch_process_death = strerror (errno); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
575 } |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
576 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
577 emacs_close (outfilefd); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
578 if (fd_error != outfilefd) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
579 emacs_close (fd_error); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
580 fd1 = -1; /* No harm in closing that one! */ |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
581 /* Since CRLF is converted to LF within `decode_coding', we can |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
582 always open a file with binary mode. */ |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
583 fd[0] = emacs_open (tempfile, O_RDONLY | O_BINARY, 0); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
584 if (fd[0] < 0) |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
585 { |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
586 unlink (tempfile); |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
587 emacs_close (filefd); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
588 report_file_error ("Cannot re-open temporary file", Qnil); |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
589 } |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
590 #else /* not MSDOS */ |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
591 #ifdef WINDOWSNT |
20525
468f59c6c9bf
(Fcall_process): Cast new_argv for child_setup.
Richard M. Stallman <rms@gnu.org>
parents:
20448
diff
changeset
|
592 pid = child_setup (filefd, fd1, fd_error, (char **) new_argv, |
468f59c6c9bf
(Fcall_process): Cast new_argv for child_setup.
Richard M. Stallman <rms@gnu.org>
parents:
20448
diff
changeset
|
593 0, current_dir); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
594 #else /* not WINDOWSNT */ |
296 | 595 pid = vfork (); |
596 | |
597 if (pid == 0) | |
598 { | |
599 if (fd[0] >= 0) | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
600 emacs_close (fd[0]); |
18235
43ce16d5f31e
(Fcall_process): Use setsid to disconnect child
Richard M. Stallman <rms@gnu.org>
parents:
18182
diff
changeset
|
601 #ifdef HAVE_SETSID |
43ce16d5f31e
(Fcall_process): Use setsid to disconnect child
Richard M. Stallman <rms@gnu.org>
parents:
18182
diff
changeset
|
602 setsid (); |
43ce16d5f31e
(Fcall_process): Use setsid to disconnect child
Richard M. Stallman <rms@gnu.org>
parents:
18182
diff
changeset
|
603 #endif |
43ce16d5f31e
(Fcall_process): Use setsid to disconnect child
Richard M. Stallman <rms@gnu.org>
parents:
18182
diff
changeset
|
604 #if defined (USG) && !defined (BSD_PGRPS) |
296 | 605 setpgrp (); |
606 #else | |
607 setpgrp (pid, pid); | |
608 #endif /* USG */ | |
20525
468f59c6c9bf
(Fcall_process): Cast new_argv for child_setup.
Richard M. Stallman <rms@gnu.org>
parents:
20448
diff
changeset
|
609 child_setup (filefd, fd1, fd_error, (char **) new_argv, |
468f59c6c9bf
(Fcall_process): Cast new_argv for child_setup.
Richard M. Stallman <rms@gnu.org>
parents:
20448
diff
changeset
|
610 0, current_dir); |
296 | 611 } |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
612 #endif /* not WINDOWSNT */ |
15225
a78a1df9690c
(Fcall_process): Fix previous change (now !MSDOS only).
Richard M. Stallman <rms@gnu.org>
parents:
15210
diff
changeset
|
613 |
a78a1df9690c
(Fcall_process): Fix previous change (now !MSDOS only).
Richard M. Stallman <rms@gnu.org>
parents:
15210
diff
changeset
|
614 /* The MSDOS case did this already. */ |
a78a1df9690c
(Fcall_process): Fix previous change (now !MSDOS only).
Richard M. Stallman <rms@gnu.org>
parents:
15210
diff
changeset
|
615 if (fd_error >= 0) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
616 emacs_close (fd_error); |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
617 #endif /* not MSDOS */ |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
618 #endif /* not macintosh */ |
296 | 619 |
620 environ = save_environ; | |
621 | |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
622 /* 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
|
623 since we will use that to read input from. */ |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
624 emacs_close (filefd); |
15236
99d01b1b8799
(Fcall_process): Don't close the same fd twice.
Karl Heuer <kwzh@gnu.org>
parents:
15225
diff
changeset
|
625 if (fd1 >= 0 && fd1 != fd_error) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
626 emacs_close (fd1); |
296 | 627 } |
628 | |
629 if (pid < 0) | |
630 { | |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
631 if (fd[0] >= 0) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
632 emacs_close (fd[0]); |
296 | 633 report_file_error ("Doing vfork", Qnil); |
634 } | |
635 | |
9138
6c814eb4d892
(Fcall_process, child_setup, getenv_internal): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8853
diff
changeset
|
636 if (INTEGERP (buffer)) |
296 | 637 { |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
638 if (fd[0] >= 0) |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
639 emacs_close (fd[0]); |
296 | 640 #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
|
641 /* 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
|
642 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
|
643 the facilities for handling SIGCHLD. */ |
296 | 644 wait_without_blocking (); |
645 #endif /* subprocesses */ | |
646 return Qnil; | |
647 } | |
648 | |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
649 /* 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
|
650 call_process_exited = 0; |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
651 |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
652 #if defined(MSDOS) || defined(macintosh) |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
653 /* 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
|
654 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
|
655 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
|
656 #else |
296 | 657 record_unwind_protect (call_process_cleanup, |
658 Fcons (make_number (fd[0]), make_number (pid))); | |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
659 #endif /* not MSDOS and not macintosh */ |
296 | 660 |
661 | |
9138
6c814eb4d892
(Fcall_process, child_setup, getenv_internal): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8853
diff
changeset
|
662 if (BUFFERP (buffer)) |
296 | 663 Fset_buffer (buffer); |
664 | |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
665 if (NILP (buffer)) |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
666 { |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
667 /* If BUFFER is nil, we must read process output once and then |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
668 discard it, so setup coding system but with nil. */ |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
669 setup_coding_system (Qnil, &process_coding); |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
670 } |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
671 else |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
672 { |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
673 Lisp_Object val, *args2; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
674 |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
675 val = Qnil; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
676 if (!NILP (Vcoding_system_for_read)) |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
677 val = Vcoding_system_for_read; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
678 else |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
679 { |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
680 if (EQ (coding_systems, Qt)) |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
681 { |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
682 int i; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
683 |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
684 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
685 args2[0] = Qcall_process; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
686 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
687 coding_systems |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
688 = Ffind_operation_coding_system (nargs + 1, args2); |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
689 } |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
690 if (CONSP (coding_systems)) |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
691 val = XCAR (coding_systems); |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
692 else if (CONSP (Vdefault_process_coding_system)) |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
693 val = XCAR (Vdefault_process_coding_system); |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
694 else |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
695 val = Qnil; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
696 } |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
697 setup_coding_system (Fcheck_coding_system (val), &process_coding); |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
698 /* In unibyte mode, character code conversion should not take |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
699 place but EOL conversion should. So, setup raw-text or one |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
700 of the subsidiary according to the information just setup. */ |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
701 if (NILP (current_buffer->enable_multibyte_characters) |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
702 && !NILP (val)) |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
703 setup_raw_text_coding_system (&process_coding); |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
704 } |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
705 |
296 | 706 immediate_quit = 1; |
707 QUIT; | |
708 | |
709 { | |
710 register int nread; | |
5251
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
711 int first = 1; |
11619
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
712 int total_read = 0; |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
713 int carryover = 0; |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
714 int display_on_the_fly = !NILP (display) && INTERACTIVE; |
22320
aed8bb8b8837
(Fcall_process): Avoid initializer on auto struct.
Karl Heuer <kwzh@gnu.org>
parents:
21997
diff
changeset
|
715 struct coding_system saved_coding; |
aed8bb8b8837
(Fcall_process): Avoid initializer on auto struct.
Karl Heuer <kwzh@gnu.org>
parents:
21997
diff
changeset
|
716 |
aed8bb8b8837
(Fcall_process): Avoid initializer on auto struct.
Karl Heuer <kwzh@gnu.org>
parents:
21997
diff
changeset
|
717 saved_coding = process_coding; |
296 | 718 |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
719 while (1) |
296 | 720 { |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
721 /* Repeatedly read until we've filled as much as possible |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
722 of the buffer size we have. But don't read |
14036 | 723 less than 1024--save that for the next bufferful. */ |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
724 nread = carryover; |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
725 while (nread < bufsize - 1024) |
8853
f44e40e722b2
(Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents:
8737
diff
changeset
|
726 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
727 int this_read = emacs_read (fd[0], bufptr + nread, |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
728 bufsize - nread); |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
729 |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
730 if (this_read < 0) |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
731 goto give_up; |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
732 |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
733 if (this_read == 0) |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
734 { |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
735 process_coding.mode |= CODING_MODE_LAST_BLOCK; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
736 break; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
737 } |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
738 |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
739 nread += this_read; |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
740 total_read += this_read; |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
741 |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
742 if (display_on_the_fly) |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
743 break; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
744 } |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
745 |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
746 /* Now NREAD is the total amount of data in the buffer. */ |
296 | 747 immediate_quit = 0; |
11619
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
748 |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
749 if (!NILP (buffer)) |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
750 { |
26838
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
751 if (! CODING_REQUIRE_DECODING (&process_coding)) |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
752 insert (bufptr, nread); |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
753 else |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
754 { /* We have to decode the input. */ |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
755 int size = decoding_buffer_size (&process_coding, nread); |
24432
a1cd251f7a70
(Fcall_process): Use xmalloc, xfree.
Karl Heuer <kwzh@gnu.org>
parents:
24412
diff
changeset
|
756 char *decoding_buf = (char *) xmalloc (size); |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
757 |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
758 decode_coding (&process_coding, bufptr, decoding_buf, |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
759 nread, size); |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
760 if (display_on_the_fly |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
761 && saved_coding.type == coding_type_undecided |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
762 && process_coding.type != coding_type_undecided) |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
763 { |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
764 /* We have detected some coding system. But, |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
765 there's a possibility that the detection was |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
766 done by insufficient data. So, we give up |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
767 displaying on the fly. */ |
24432
a1cd251f7a70
(Fcall_process): Use xmalloc, xfree.
Karl Heuer <kwzh@gnu.org>
parents:
24412
diff
changeset
|
768 xfree (decoding_buf); |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
769 display_on_the_fly = 0; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
770 process_coding = saved_coding; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
771 carryover = nread; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
772 continue; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
773 } |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
774 if (process_coding.produced > 0) |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
775 insert (decoding_buf, process_coding.produced); |
24432
a1cd251f7a70
(Fcall_process): Use xmalloc, xfree.
Karl Heuer <kwzh@gnu.org>
parents:
24412
diff
changeset
|
776 xfree (decoding_buf); |
21036
3d4005eb0e71
(Fcall_process): Calculate CARRYOVER correctly.
Kenichi Handa <handa@m17n.org>
parents:
21019
diff
changeset
|
777 carryover = nread - process_coding.consumed; |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
778 if (carryover > 0) |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
779 { |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
780 /* As CARRYOVER should not be that large, we had |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
781 better avoid overhead of bcopy. */ |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
782 char *p = bufptr + process_coding.consumed; |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
783 char *pend = p + carryover; |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
784 char *dst = bufptr; |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
785 |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
786 while (p < pend) *dst++ = *p++; |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
787 } |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
788 } |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
789 } |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
790 if (process_coding.mode & CODING_MODE_LAST_BLOCK) |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
791 { |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
792 if (carryover > 0) |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
793 insert (bufptr, carryover); |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
794 break; |
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
795 } |
11619
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
796 |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
797 /* Make the buffer bigger as we continue to read more data, |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
798 but not past 64k. */ |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
799 if (bufsize < 64 * 1024 && total_read > 32 * bufsize) |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
800 { |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
801 bufsize *= 2; |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
802 bufptr = (char *) alloca (bufsize); |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
803 } |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
804 |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
805 if (!NILP (display) && INTERACTIVE) |
5251
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
806 { |
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
807 if (first) |
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
808 prepare_menu_bars (); |
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
809 first = 0; |
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
810 redisplay_preserve_echo_area (); |
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
811 } |
296 | 812 immediate_quit = 1; |
813 QUIT; | |
814 } | |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
815 give_up: ; |
296 | 816 |
26838
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
817 Vlast_coding_system_used = process_coding.symbol; |
20436
62b0709aac6d
(Fcall_process): Set Vlast_coding_system_used after
Kenichi Handa <handa@m17n.org>
parents:
20230
diff
changeset
|
818 |
26838
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
819 /* If the caller required, let the buffer inherit the |
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
820 coding-system used to decode the process output. */ |
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
821 if (inherit_process_coding_system) |
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
822 call1 (intern ("after-insert-file-set-buffer-file-coding-system"), |
27b6d3367b47
(Fcall_process): Call code_convert_string to encode
Kenichi Handa <handa@m17n.org>
parents:
26526
diff
changeset
|
823 make_number (total_read)); |
21572 | 824 } |
825 | |
296 | 826 /* Wait for it to terminate, unless it already has. */ |
827 wait_for_termination (pid); | |
828 | |
829 immediate_quit = 0; | |
830 | |
831 set_buffer_internal (old); | |
832 | |
6275
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
833 /* 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
|
834 when exiting. */ |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
835 call_process_exited = 1; |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
836 |
296 | 837 unbind_to (count, Qnil); |
838 | |
839 if (synch_process_death) | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
840 return code_convert_string_norecord (build_string (synch_process_death), |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
841 Vlocale_coding_system, 0); |
296 | 842 return make_number (synch_process_retcode); |
843 } | |
844 #endif | |
845 | |
1912
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
846 static Lisp_Object |
296 | 847 delete_temp_file (name) |
848 Lisp_Object name; | |
849 { | |
10083
2d7a561cc92c
(delete_temp_file): Use internal_delete_file.
Richard M. Stallman <rms@gnu.org>
parents:
9786
diff
changeset
|
850 /* Use Fdelete_file (indirectly) because that runs a file name handler. |
8737
72b312ebaa10
(delete_temp_file): Use Fdelete_file.
Richard M. Stallman <rms@gnu.org>
parents:
8555
diff
changeset
|
851 We did that when writing the file, so we should do so when deleting. */ |
10083
2d7a561cc92c
(delete_temp_file): Use internal_delete_file.
Richard M. Stallman <rms@gnu.org>
parents:
9786
diff
changeset
|
852 internal_delete_file (name); |
296 | 853 } |
854 | |
855 DEFUN ("call-process-region", Fcall_process_region, Scall_process_region, | |
856 3, MANY, 0, | |
857 "Send text from START to END to a synchronous process running PROGRAM.\n\ | |
23885 | 858 The remaining arguments are optional.\n\ |
296 | 859 Delete the text if fourth arg DELETE is non-nil.\n\ |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
860 \n\ |
296 | 861 Insert output in BUFFER before point; t means current buffer;\n\ |
862 nil for BUFFER means discard it; 0 means discard and don't wait.\n\ | |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
863 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
864 REAL-BUFFER says what to do with standard output, as above,\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
865 while STDERR-FILE says what to do with standard error in the child.\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
866 STDERR-FILE may be nil (discard standard error output),\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
867 t (mix it with ordinary output), or a file name string.\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
868 \n\ |
296 | 869 Sixth arg DISPLAY non-nil means redisplay buffer as output is inserted.\n\ |
870 Remaining args are passed to PROGRAM at startup as command args.\n\ | |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
871 \n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
872 If BUFFER is nil, `call-process-region' returns immediately with value nil.\n\ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
873 Otherwise it 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
|
874 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
|
875 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") |
296 | 876 (nargs, args) |
877 int nargs; | |
878 register Lisp_Object *args; | |
879 { | |
8555
f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents:
7900
diff
changeset
|
880 struct gcpro gcpro1; |
f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents:
7900
diff
changeset
|
881 Lisp_Object filename_string; |
f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents:
7900
diff
changeset
|
882 register Lisp_Object start, end; |
16659
e7bf457086fb
(Fcall_process_region): Define missing local `count'.
Richard M. Stallman <rms@gnu.org>
parents:
16627
diff
changeset
|
883 int count = specpdl_ptr - specpdl; |
18539
8c13c54d52c8
Call Ffind_operation_coding_system.
Kenichi Handa <handa@m17n.org>
parents:
18494
diff
changeset
|
884 /* Qt denotes we have not yet called Ffind_operation_coding_system. */ |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
885 Lisp_Object coding_systems; |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
886 Lisp_Object val, *args2; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
887 int i; |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
888 #ifdef DOS_NT |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
889 char *tempfile; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
890 char *outf = '\0'; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
891 |
23462
aaad8461ff34
(Fcall_process): Use $TMPDIR instead of trying $TMP
Eli Zaretskii <eliz@gnu.org>
parents:
23079
diff
changeset
|
892 if ((outf = egetenv ("TMPDIR")) |
aaad8461ff34
(Fcall_process): Use $TMPDIR instead of trying $TMP
Eli Zaretskii <eliz@gnu.org>
parents:
23079
diff
changeset
|
893 || (outf = egetenv ("TMP")) |
aaad8461ff34
(Fcall_process): Use $TMPDIR instead of trying $TMP
Eli Zaretskii <eliz@gnu.org>
parents:
23079
diff
changeset
|
894 || (outf = egetenv ("TEMP"))) |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
895 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
|
896 else |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
897 { |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
898 tempfile = alloca (20); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
899 *tempfile = '\0'; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
900 } |
12238
f442c22815b8
(call-process-region) [DOS_NT]: Use IS_DIRECTORY_SEP.
Richard M. Stallman <rms@gnu.org>
parents:
11780
diff
changeset
|
901 if (!IS_DIRECTORY_SEP (tempfile[strlen (tempfile) - 1])) |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
902 strcat (tempfile, "/"); |
15824
11517dc55f5b
(Fcall_process_region) [DOS_NT]: Avoid downcasing
Richard M. Stallman <rms@gnu.org>
parents:
15610
diff
changeset
|
903 if ('/' == DIRECTORY_SEP) |
11517dc55f5b
(Fcall_process_region) [DOS_NT]: Avoid downcasing
Richard M. Stallman <rms@gnu.org>
parents:
15610
diff
changeset
|
904 dostounix_filename (tempfile); |
11517dc55f5b
(Fcall_process_region) [DOS_NT]: Avoid downcasing
Richard M. Stallman <rms@gnu.org>
parents:
15610
diff
changeset
|
905 else |
11517dc55f5b
(Fcall_process_region) [DOS_NT]: Avoid downcasing
Richard M. Stallman <rms@gnu.org>
parents:
15610
diff
changeset
|
906 unixtodos_filename (tempfile); |
12238
f442c22815b8
(call-process-region) [DOS_NT]: Use IS_DIRECTORY_SEP.
Richard M. Stallman <rms@gnu.org>
parents:
11780
diff
changeset
|
907 #ifdef WINDOWSNT |
f442c22815b8
(call-process-region) [DOS_NT]: Use IS_DIRECTORY_SEP.
Richard M. Stallman <rms@gnu.org>
parents:
11780
diff
changeset
|
908 strcat (tempfile, "emXXXXXX"); |
f442c22815b8
(call-process-region) [DOS_NT]: Use IS_DIRECTORY_SEP.
Richard M. Stallman <rms@gnu.org>
parents:
11780
diff
changeset
|
909 #else |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
910 strcat (tempfile, "detmp.XXX"); |
12238
f442c22815b8
(call-process-region) [DOS_NT]: Use IS_DIRECTORY_SEP.
Richard M. Stallman <rms@gnu.org>
parents:
11780
diff
changeset
|
911 #endif |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
912 #else /* not DOS_NT */ |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
21209
diff
changeset
|
913 char *tempfile = (char *) alloca (STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); |
16627
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
914 bcopy (XSTRING (Vtemp_file_name_pattern)->data, tempfile, |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
21209
diff
changeset
|
915 STRING_BYTES (XSTRING (Vtemp_file_name_pattern)) + 1); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
916 #endif /* not DOS_NT */ |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
917 |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
918 coding_systems = Qt; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
919 |
296 | 920 mktemp (tempfile); |
921 | |
922 filename_string = build_string (tempfile); | |
8555
f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents:
7900
diff
changeset
|
923 GCPRO1 (filename_string); |
296 | 924 start = args[0]; |
925 end = args[1]; | |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
926 /* Decide coding-system of the contents of the temporary file. */ |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
927 if (!NILP (Vcoding_system_for_write)) |
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
928 val = Vcoding_system_for_write; |
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
929 else if (NILP (current_buffer->enable_multibyte_characters)) |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
930 val = Qnil; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
931 else |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
932 { |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
933 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); |
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
934 args2[0] = Qcall_process_region; |
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
935 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; |
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
936 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); |
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
937 if (CONSP (coding_systems)) |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
938 val = XCDR (coding_systems); |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
939 else if (CONSP (Vdefault_process_coding_system)) |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
940 val = XCDR (Vdefault_process_coding_system); |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
941 else |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
942 val = Qnil; |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
943 } |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
944 |
21626
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
945 { |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
946 int count1 = specpdl_ptr - specpdl; |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
947 |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
948 specbind (intern ("coding-system-for-write"), val); |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
949 Fwrite_region (start, end, filename_string, Qnil, Qlambda, Qnil, Qnil); |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
950 |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
951 unbind_to (count1, Qnil); |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
952 } |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
953 |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
954 /* Note that Fcall_process takes care of binding |
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
955 coding-system-for-read. */ |
7397
e0ffa47f2ed4
[MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents:
7161
diff
changeset
|
956 |
296 | 957 record_unwind_protect (delete_temp_file, filename_string); |
958 | |
23885 | 959 if (nargs > 3 && !NILP (args[3])) |
296 | 960 Fdelete_region (start, end); |
961 | |
23885 | 962 if (nargs > 3) |
963 { | |
964 args += 2; | |
965 nargs -= 2; | |
966 } | |
967 else | |
968 { | |
969 args[0] = args[2]; | |
970 nargs = 2; | |
971 } | |
972 args[1] = filename_string; | |
296 | 973 |
23885 | 974 RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args))); |
296 | 975 } |
976 | |
977 #ifndef VMS /* VMS version is in vmsproc.c. */ | |
978 | |
21514 | 979 static int relocate_fd (); |
980 | |
296 | 981 /* This is the last thing run in a newly forked inferior |
982 either synchronous or asynchronous. | |
983 Copy descriptors IN, OUT and ERR as descriptors 0, 1 and 2. | |
984 Initialize inferior's priority, pgrp, connected dir and environment. | |
985 then exec another program based on new_argv. | |
986 | |
987 This function may change environ for the superior process. | |
988 Therefore, the superior process must save and restore the value | |
989 of environ around the vfork and the call to this function. | |
990 | |
991 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
|
992 process group. |
296 | 993 |
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 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
|
995 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
|
996 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
|
997 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
|
998 |
21514 | 999 int |
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
|
1000 child_setup (in, out, err, new_argv, set_pgrp, current_dir) |
296 | 1001 int in, out, err; |
1002 register char **new_argv; | |
1003 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
|
1004 Lisp_Object current_dir; |
296 | 1005 { |
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
|
1006 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
|
1007 char *pwd_var; |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1008 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1009 int cpid; |
15087
46157341f721
(Fcall_process) [WINDOWSNT]: Remove conditional NT code.
Richard M. Stallman <rms@gnu.org>
parents:
14872
diff
changeset
|
1010 HANDLE handles[3]; |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1011 #endif /* WINDOWSNT */ |
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
|
1012 |
5530
7ff479a8e8bf
(child_setup): Don't declare PID `register'; we later take its address.
Roland McGrath <roland@gnu.org>
parents:
5516
diff
changeset
|
1013 int pid = getpid (); |
296 | 1014 |
7481
b7d23c08750c
(child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents:
7465
diff
changeset
|
1015 #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
|
1016 { |
4ea86d32c012
* callproc.c (child_setup): Don't use setpriority; we just need a
Jim Blandy <jimb@redhat.com>
parents:
948
diff
changeset
|
1017 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
|
1018 |
7481
b7d23c08750c
(child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents:
7465
diff
changeset
|
1019 if (emacs_priority < 0) |
b7d23c08750c
(child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents:
7465
diff
changeset
|
1020 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
|
1021 } |
7161
67618cd7bdbf
(child_setup): Test PRIO_PROCESS, as in sys_subshell.
Richard M. Stallman <rms@gnu.org>
parents:
7000
diff
changeset
|
1022 #endif |
296 | 1023 |
1024 #ifdef subprocesses | |
1025 /* Close Emacs's descriptors that this process should not have. */ | |
1026 close_process_descs (); | |
1027 #endif | |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1028 /* DOS_NT isn't in a vfork, so if we are in the middle of load-file, |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1029 we will lose if we call close_load_descs here. */ |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1030 #ifndef DOS_NT |
5569
b9e2884ca8e6
(child_setup): Call close_load_descs.
Richard M. Stallman <rms@gnu.org>
parents:
5530
diff
changeset
|
1031 close_load_descs (); |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1032 #endif |
296 | 1033 |
1034 /* Note that use of alloca is always safe here. It's obvious for systems | |
1035 that do not have true vfork or that have true (stack) alloca. | |
1036 If using vfork and C_ALLOCA it is safe because that changes | |
1037 the superior's static variables as if the superior had done alloca | |
1038 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
|
1039 { |
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
|
1040 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
|
1041 register int i; |
296 | 1042 |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
21209
diff
changeset
|
1043 i = STRING_BYTES (XSTRING (current_dir)); |
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
|
1044 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
|
1045 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
|
1046 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
|
1047 bcopy (XSTRING (current_dir)->data, temp, i); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1048 if (!IS_DIRECTORY_SEP (temp[i - 1])) temp[i++] = DIRECTORY_SEP; |
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
|
1049 temp[i] = 0; |
538 | 1050 |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1051 #ifndef DOS_NT |
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
|
1052 /* 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
|
1053 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
|
1054 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
|
1055 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
|
1056 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
|
1057 if (chdir (temp) < 0) |
9609
74985a8972e4
(child_setup): Always use _exit.
Richard M. Stallman <rms@gnu.org>
parents:
9138
diff
changeset
|
1058 _exit (errno); |
19967
685d256c8cb5
(child_setup) [WINDOWSNT]: Change directory of
Geoff Voelker <voelker@cs.washington.edu>
parents:
19838
diff
changeset
|
1059 #endif |
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
|
1060 |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1061 #ifdef DOS_NT |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1062 /* Get past the drive letter, so that d:/ is left alone. */ |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1063 if (i > 2 && IS_DEVICE_SEP (temp[1]) && IS_DIRECTORY_SEP (temp[2])) |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1064 { |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1065 temp += 2; |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1066 i -= 2; |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1067 } |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1068 #endif |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1069 |
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
|
1070 /* Strip trailing slashes for PWD, but leave "/" and "//" alone. */ |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1071 while (i > 2 && IS_DIRECTORY_SEP (temp[i - 1])) |
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
|
1072 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
|
1073 } |
296 | 1074 |
1075 /* Set `env' to a vector of the strings in Vprocess_environment. */ | |
1076 { | |
1077 register Lisp_Object tem; | |
1078 register char **new_env; | |
1079 register int new_length; | |
1080 | |
1081 new_length = 0; | |
1082 for (tem = Vprocess_environment; | |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
1083 CONSP (tem) && STRINGP (XCAR (tem)); |
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
1084 tem = XCDR (tem)) |
296 | 1085 new_length++; |
1086 | |
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
|
1087 /* 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
|
1088 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
|
1089 |
e422f06592d3
(child_setup): If PWD is set, set it in the child so that
Richard M. Stallman <rms@gnu.org>
parents:
7481
diff
changeset
|
1090 /* 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
|
1091 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
|
1092 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
|
1093 *new_env++ = pwd_var; |
296 | 1094 |
2757
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1095 /* Copy the Vprocess_environment strings into new_env. */ |
296 | 1096 for (tem = Vprocess_environment; |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
1097 CONSP (tem) && STRINGP (XCAR (tem)); |
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
1098 tem = XCDR (tem)) |
2757
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1099 { |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1100 char **ep = env; |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
1101 char *string = (char *) XSTRING (XCAR (tem))->data; |
2757
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1102 /* 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
|
1103 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
|
1104 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
|
1105 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
|
1106 for (; ep != new_env; ep++) |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1107 { |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1108 char *p = *ep, *q = string; |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1109 while (1) |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1110 { |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1111 if (*q == 0) |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1112 /* 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
|
1113 goto duplicate; |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1114 if (*q != *p) |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1115 break; |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1116 if (*q == '=') |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1117 goto duplicate; |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1118 p++, q++; |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1119 } |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1120 } |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1121 *new_env++ = string; |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1122 duplicate: ; |
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1123 } |
296 | 1124 *new_env = 0; |
1125 } | |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1126 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1127 prepare_standard_handles (in, out, err, handles); |
19967
685d256c8cb5
(child_setup) [WINDOWSNT]: Change directory of
Geoff Voelker <voelker@cs.washington.edu>
parents:
19838
diff
changeset
|
1128 set_process_dir (XSTRING (current_dir)->data); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1129 #else /* not WINDOWSNT */ |
2286
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1130 /* 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
|
1131 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
|
1132 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
|
1133 happen under X. */ |
12430
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1134 { |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1135 int oin = in, oout = out; |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1136 |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1137 /* We have to avoid relocating the same descriptor twice! */ |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1138 |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1139 in = relocate_fd (in, 3); |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1140 |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1141 if (out == oin) |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1142 out = in; |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1143 else |
6614
e095c5efe2e0
(child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents:
6495
diff
changeset
|
1144 out = relocate_fd (out, 3); |
12430
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1145 |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1146 if (err == oin) |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1147 err = in; |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1148 else if (err == oout) |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1149 err = out; |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1150 else |
6614
e095c5efe2e0
(child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents:
6495
diff
changeset
|
1151 err = relocate_fd (err, 3); |
12430
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1152 } |
2286
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1153 |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1154 #ifndef MSDOS |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1155 emacs_close (0); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1156 emacs_close (1); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1157 emacs_close (2); |
296 | 1158 |
1159 dup2 (in, 0); | |
1160 dup2 (out, 1); | |
1161 dup2 (err, 2); | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1162 emacs_close (in); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1163 emacs_close (out); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1164 emacs_close (err); |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1165 #endif /* not MSDOS */ |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1166 #endif /* not WINDOWSNT */ |
296 | 1167 |
14872
c001b28bf068
(Fcall_process, child_setup): If BSD_PGRPS, call
Richard M. Stallman <rms@gnu.org>
parents:
14438
diff
changeset
|
1168 #if defined(USG) && !defined(BSD_PGRPS) |
5179
2a1492764d5e
(child_setup): Test SETPGRP_RELEASES_CTTY, not IRIX.
Richard M. Stallman <rms@gnu.org>
parents:
5154
diff
changeset
|
1169 #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
|
1170 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
|
1171 #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
|
1172 #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
|
1173 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
|
1174 #endif /* USG */ |
5348 | 1175 /* setpgrp_of_tty is incorrect here; it uses input_fd. */ |
1176 EMACS_SET_TTY_PGRP (0, &pid); | |
296 | 1177 |
1178 #ifdef vipc | |
1179 something missing here; | |
1180 #endif /* vipc */ | |
1181 | |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1182 #ifdef MSDOS |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1183 pid = run_msdos_command (new_argv, pwd_var + 4, in, out, err, env); |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1184 if (pid == -1) |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1185 /* An error occurred while trying to run the subprocess. */ |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1186 report_file_error ("Spawning child process", Qnil); |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1187 return pid; |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1188 #else /* not MSDOS */ |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1189 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1190 /* Spawn the child. (See ntproc.c:Spawnve). */ |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1191 cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); |
20041
c743e52dd2b0
Ensure standard handles are reset even if spawnve fails.
Andrew Innes <andrewi@gnu.org>
parents:
19967
diff
changeset
|
1192 reset_standard_handles (in, out, err, handles); |
11379
23f7aa711f96
(child_setup) [WINDOWSNT]: Removed syntax errors.
Karl Heuer <kwzh@gnu.org>
parents:
11235
diff
changeset
|
1193 if (cpid == -1) |
23f7aa711f96
(child_setup) [WINDOWSNT]: Removed syntax errors.
Karl Heuer <kwzh@gnu.org>
parents:
11235
diff
changeset
|
1194 /* An error occurred while trying to spawn the process. */ |
23f7aa711f96
(child_setup) [WINDOWSNT]: Removed syntax errors.
Karl Heuer <kwzh@gnu.org>
parents:
11235
diff
changeset
|
1195 report_file_error ("Spawning child process", Qnil); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1196 return cpid; |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1197 #else /* not WINDOWSNT */ |
296 | 1198 /* execvp does not accept an environment arg so the only way |
1199 to pass this environment is to set environ. Our caller | |
1200 is responsible for restoring the ambient value of environ. */ | |
1201 environ = env; | |
1202 execvp (new_argv[0], new_argv); | |
1203 | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1204 emacs_write (1, "Can't exec program: ", 20); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1205 emacs_write (1, new_argv[0], strlen (new_argv[0])); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1206 emacs_write (1, "\n", 1); |
296 | 1207 _exit (1); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1208 #endif /* not WINDOWSNT */ |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
1209 #endif /* not MSDOS */ |
296 | 1210 } |
1211 | |
21454
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1212 /* Move the file descriptor FD so that its number is not less than MINFD. |
2286
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1213 If the file descriptor is moved at all, the original is freed. */ |
21514 | 1214 static int |
21454
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1215 relocate_fd (fd, minfd) |
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1216 int fd, minfd; |
2286
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1217 { |
21454
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1218 if (fd >= minfd) |
2286
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1219 return fd; |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1220 else |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1221 { |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1222 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
|
1223 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
|
1224 { |
2509
daaa78c8c980
* callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents:
2432
diff
changeset
|
1225 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
|
1226 char *errmessage = strerror (errno); |
2509
daaa78c8c980
* callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents:
2432
diff
changeset
|
1227 char *message2 = "\n"; |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1228 emacs_write (2, message1, strlen (message1)); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1229 emacs_write (2, errmessage, strlen (errmessage)); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1230 emacs_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
|
1231 _exit (1); |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1232 } |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1233 /* 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
|
1234 to guarantee we'll get a new FD if we need it. */ |
21454
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1235 new = relocate_fd (new, minfd); |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1236 emacs_close (fd); |
2286
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1237 return new; |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1238 } |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1239 } |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1240 |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1241 static int |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1242 getenv_internal (var, varlen, value, valuelen) |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1243 char *var; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1244 int varlen; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1245 char **value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1246 int *valuelen; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1247 { |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1248 Lisp_Object scan; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1249 |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
1250 for (scan = Vprocess_environment; CONSP (scan); scan = XCDR (scan)) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1251 { |
6495
c88f34090aea
(call_process_cleanup, getenv_internal): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6466
diff
changeset
|
1252 Lisp_Object entry; |
c88f34090aea
(call_process_cleanup, getenv_internal): Use assignment, not initialization.
Karl Heuer <kwzh@gnu.org>
parents:
6466
diff
changeset
|
1253 |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
1254 entry = XCAR (scan); |
9138
6c814eb4d892
(Fcall_process, child_setup, getenv_internal): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8853
diff
changeset
|
1255 if (STRINGP (entry) |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
21209
diff
changeset
|
1256 && STRING_BYTES (XSTRING (entry)) > varlen |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1257 && XSTRING (entry)->data[varlen] == '=' |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1258 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1259 /* NT environment variables are case insensitive. */ |
11393
81653012e0a6
(getenv_internal): Balance parentheses across #if/#endif.
Karl Heuer <kwzh@gnu.org>
parents:
11379
diff
changeset
|
1260 && ! strnicmp (XSTRING (entry)->data, var, varlen) |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1261 #else /* not WINDOWSNT */ |
11393
81653012e0a6
(getenv_internal): Balance parentheses across #if/#endif.
Karl Heuer <kwzh@gnu.org>
parents:
11379
diff
changeset
|
1262 && ! bcmp (XSTRING (entry)->data, var, varlen) |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1263 #endif /* not WINDOWSNT */ |
11393
81653012e0a6
(getenv_internal): Balance parentheses across #if/#endif.
Karl Heuer <kwzh@gnu.org>
parents:
11379
diff
changeset
|
1264 ) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1265 { |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1266 *value = (char *) XSTRING (entry)->data + (varlen + 1); |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
21209
diff
changeset
|
1267 *valuelen = STRING_BYTES (XSTRING (entry)) - (varlen + 1); |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1268 return 1; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1269 } |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1270 } |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1271 |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1272 return 0; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1273 } |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1274 |
5251
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
1275 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
|
1276 "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
|
1277 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
|
1278 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
|
1279 (var) |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1280 Lisp_Object var; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1281 { |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1282 char *value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1283 int valuelen; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1284 |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1285 CHECK_STRING (var, 0); |
21244
50929073a0ba
Use STRING_BYTES and SET_STRING_BYTES.
Richard M. Stallman <rms@gnu.org>
parents:
21209
diff
changeset
|
1286 if (getenv_internal (XSTRING (var)->data, STRING_BYTES (XSTRING (var)), |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1287 &value, &valuelen)) |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1288 return make_string (value, valuelen); |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1289 else |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1290 return Qnil; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1291 } |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1292 |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1293 /* 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
|
1294 callable from C. */ |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1295 char * |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1296 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
|
1297 char *var; |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1298 { |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1299 char *value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1300 int valuelen; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1301 |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1302 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
|
1303 return value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1304 else |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1305 return 0; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1306 } |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1307 |
296 | 1308 #endif /* not VMS */ |
1309 | |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1310 /* 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
|
1311 |
21514 | 1312 void |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1313 init_callproc_1 () |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1314 { |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1315 char *data_dir = egetenv ("EMACSDATA"); |
6031
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1316 char *doc_dir = egetenv ("EMACSDOC"); |
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1317 |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1318 Vdata_directory |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
1319 = 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
|
1320 : PATH_DATA)); |
6031
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1321 Vdoc_directory |
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1322 = 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
|
1323 : 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
|
1324 |
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
1325 /* Check the EMACSPATH environment variable, defaulting to the |
24412
d11ac02f9d6a
Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents:
23885
diff
changeset
|
1326 PATH_EXEC path from epaths.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
|
1327 Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC); |
296 | 1328 Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path)); |
1329 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
|
1330 } |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1331 |
12615
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1332 /* This is run after init_cmdargs, when Vinstallation_directory is valid. */ |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1333 |
21514 | 1334 void |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1335 init_callproc () |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1336 { |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1337 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
|
1338 |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1339 register char * sh; |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1340 Lisp_Object tempdir; |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1341 |
22373
cb8484085daf
(init_callproc): Check Vinstallation_directory even if !initialized.
Richard M. Stallman <rms@gnu.org>
parents:
22320
diff
changeset
|
1342 if (!NILP (Vinstallation_directory)) |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1343 { |
5618
a70dc7c886d0
(init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents:
5569
diff
changeset
|
1344 /* 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
|
1345 Lisp_Object tem; |
a70dc7c886d0
(init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents:
5569
diff
changeset
|
1346 tem = Fexpand_file_name (build_string ("lib-src"), |
a70dc7c886d0
(init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents:
5569
diff
changeset
|
1347 Vinstallation_directory); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1348 #ifndef DOS_NT |
7824
de1dfb8aea82
(init_callproc) [MSDOS]: Exclude less code, so ../etc
Richard M. Stallman <rms@gnu.org>
parents:
7782
diff
changeset
|
1349 /* MSDOS uses wrapped binaries, so don't do this. */ |
24920
d95c8bcfe8ae
(init_callproc): Set exec_directory if installation_directory is
Richard M. Stallman <rms@gnu.org>
parents:
24432
diff
changeset
|
1350 if (NILP (Fmember (tem, Vexec_path))) |
d95c8bcfe8ae
(init_callproc): Set exec_directory if installation_directory is
Richard M. Stallman <rms@gnu.org>
parents:
24432
diff
changeset
|
1351 Vexec_path = nconc2 (Vexec_path, Fcons (tem, Qnil)); |
d95c8bcfe8ae
(init_callproc): Set exec_directory if installation_directory is
Richard M. Stallman <rms@gnu.org>
parents:
24432
diff
changeset
|
1352 |
d95c8bcfe8ae
(init_callproc): Set exec_directory if installation_directory is
Richard M. Stallman <rms@gnu.org>
parents:
24432
diff
changeset
|
1353 Vexec_directory = Ffile_name_as_directory (tem); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1354 #endif /* not DOS_NT */ |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1355 |
12615
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1356 /* Maybe use ../etc as well as ../lib-src. */ |
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1357 if (data_dir == 0) |
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1358 { |
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1359 tem = Fexpand_file_name (build_string ("etc"), |
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1360 Vinstallation_directory); |
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1361 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
|
1362 } |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1363 } |
7465
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1364 |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1365 /* 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
|
1366 Vinstallation_directory, because these files are never installed |
12615
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1367 near the executable, and they are never in the build |
7465
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1368 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
|
1369 |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1370 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
|
1371 source directory. */ |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1372 if (data_dir == 0) |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1373 { |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1374 Lisp_Object tem, tem1, newdir; |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1375 |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1376 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
|
1377 tem1 = Ffile_exists_p (tem); |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1378 if (NILP (tem1)) |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1379 { |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1380 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
|
1381 build_string (PATH_DUMPLOADSEARCH)); |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1382 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
|
1383 tem1 = Ffile_exists_p (tem); |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1384 if (!NILP (tem1)) |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1385 Vdata_directory = newdir; |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1386 } |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1387 } |
296 | 1388 |
19498
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1389 #ifndef CANNOT_DUMP |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1390 if (initialized) |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1391 #endif |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1392 { |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1393 tempdir = Fdirectory_file_name (Vexec_directory); |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1394 if (access (XSTRING (tempdir)->data, 0) < 0) |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1395 dir_warning ("Warning: arch-dependent data dir (%s) does not exist.\n", |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1396 Vexec_directory); |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1397 } |
296 | 1398 |
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
|
1399 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
|
1400 if (access (XSTRING (tempdir)->data, 0) < 0) |
16486
30b8c014eaa7
(init_callproc): Use dir_warning.
Richard M. Stallman <rms@gnu.org>
parents:
15824
diff
changeset
|
1401 dir_warning ("Warning: arch-independent data dir (%s) does not exist.\n", |
30b8c014eaa7
(init_callproc): Use dir_warning.
Richard M. Stallman <rms@gnu.org>
parents:
15824
diff
changeset
|
1402 Vdata_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
|
1403 |
296 | 1404 #ifdef VMS |
1405 Vshell_file_name = build_string ("*dcl*"); | |
1406 #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
|
1407 sh = (char *) getenv ("SHELL"); |
296 | 1408 Vshell_file_name = build_string (sh ? sh : "/bin/sh"); |
1409 #endif | |
16627
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1410 |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1411 #ifdef VMS |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1412 Vtemp_file_name_pattern = build_string ("tmp:emacsXXXXXX."); |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1413 #else |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1414 if (getenv ("TMPDIR")) |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1415 { |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1416 char *dir = getenv ("TMPDIR"); |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1417 Vtemp_file_name_pattern |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1418 = Fexpand_file_name (build_string ("emacsXXXXXX"), |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1419 build_string (dir)); |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1420 } |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1421 else |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1422 Vtemp_file_name_pattern = build_string ("/tmp/emacsXXXXXX"); |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1423 #endif |
1912
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1424 } |
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1425 |
21514 | 1426 void |
1912
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1427 set_process_environment () |
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1428 { |
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1429 register char **envp; |
296 | 1430 |
1431 Vprocess_environment = Qnil; | |
1432 #ifndef CANNOT_DUMP | |
1433 if (initialized) | |
1434 #endif | |
1435 for (envp = environ; *envp; envp++) | |
1436 Vprocess_environment = Fcons (build_string (*envp), | |
1437 Vprocess_environment); | |
1438 } | |
1439 | |
21514 | 1440 void |
296 | 1441 syms_of_callproc () |
1442 { | |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1443 #ifdef DOS_NT |
7397
e0ffa47f2ed4
[MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents:
7161
diff
changeset
|
1444 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
|
1445 staticpro (&Qbuffer_file_type); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1446 #endif /* DOS_NT */ |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
1447 |
296 | 1448 DEFVAR_LISP ("shell-file-name", &Vshell_file_name, |
1449 "*File name to load inferior shells from.\n\ | |
1450 Initialized from the SHELL environment variable."); | |
1451 | |
1452 DEFVAR_LISP ("exec-path", &Vexec_path, | |
1453 "*List of directories to search programs to run in subprocesses.\n\ | |
1454 Each element is a string (directory name) or nil (try default directory)."); | |
1455 | |
1456 DEFVAR_LISP ("exec-directory", &Vexec_directory, | |
21209
bfb9556f87db
(syms_of_callproc): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
21053
diff
changeset
|
1457 "Directory for executables for Emacs to invoke.\n\ |
bfb9556f87db
(syms_of_callproc): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
21053
diff
changeset
|
1458 More generally, this includes any architecture-dependent files\n\ |
bfb9556f87db
(syms_of_callproc): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
21053
diff
changeset
|
1459 that are built and installed from the Emacs distribution."); |
439 | 1460 |
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
|
1461 DEFVAR_LISP ("data-directory", &Vdata_directory, |
21209
bfb9556f87db
(syms_of_callproc): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
21053
diff
changeset
|
1462 "Directory of machine-independent files that come with GNU Emacs.\n\ |
bfb9556f87db
(syms_of_callproc): Doc fixes.
Richard M. Stallman <rms@gnu.org>
parents:
21053
diff
changeset
|
1463 These are files intended for Emacs to use while it runs."); |
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
|
1464 |
6031
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1465 DEFVAR_LISP ("doc-directory", &Vdoc_directory, |
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1466 "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
|
1467 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
|
1468 |
3064
fa5466904709
* paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
1469 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
|
1470 "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
|
1471 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
|
1472 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
|
1473 includes this."); |
fa5466904709
* paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
1474 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
|
1475 |
16627
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1476 DEFVAR_LISP ("temp-file-name-pattern", &Vtemp_file_name_pattern, |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1477 "Pattern for making names for temporary files.\n\ |
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1478 This is used by `call-process-region'."); |
19012
b08145625f89
(syms_of_callproc): Don't init Vtemp_file_name_pattern here.
Richard M. Stallman <rms@gnu.org>
parents:
18765
diff
changeset
|
1479 /* This variable is initialized in init_callproc. */ |
16627
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1480 |
296 | 1481 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
|
1482 "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
|
1483 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
|
1484 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
|
1485 when Emacs starts."); |
296 | 1486 |
1487 #ifndef VMS | |
1488 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
|
1489 defsubr (&Sgetenv); |
296 | 1490 #endif |
1491 defsubr (&Scall_process_region); | |
1492 } |