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