Mercurial > emacs
annotate src/callproc.c @ 104747:c5c19a215021
*** empty log message ***
author | Nick Roberts <nickrob@snap.net.nz> |
---|---|
date | Mon, 31 Aug 2009 00:27:04 +0000 |
parents | f369eb846e57 |
children | 68dd71358159 |
rev | line source |
---|---|
296 | 1 /* Synchronous subprocess invocation for GNU Emacs. |
60891
8881d5e2d23f
(Vdoc_file_name, Vfile_name_coding_system)
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
57892
diff
changeset
|
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001, |
100951 | 3 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 |
79759 | 4 Free Software Foundation, Inc. |
296 | 5 |
6 This file is part of GNU Emacs. | |
7 | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91551
diff
changeset
|
8 GNU Emacs is free software: you can redistribute it and/or modify |
296 | 9 it under the terms of the GNU General Public License as published by |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91551
diff
changeset
|
10 the Free Software Foundation, either version 3 of the License, or |
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91551
diff
changeset
|
11 (at your option) any later version. |
296 | 12 |
13 GNU Emacs is distributed in the hope that it will be useful, | |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 GNU General Public License for more details. | |
17 | |
18 You should have received a copy of the GNU General Public License | |
94963
8971ddf55736
Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents:
91551
diff
changeset
|
19 along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ |
296 | 20 |
21 | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
22 #include <config.h> |
296 | 23 #include <signal.h> |
948
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
24 #include <errno.h> |
7900
60795e826dad
Put stdio.h after config.h.
Richard M. Stallman <rms@gnu.org>
parents:
7824
diff
changeset
|
25 #include <stdio.h> |
296 | 26 |
31100
92f108b8b281
[USE_CRT_DLL]: Remove unnecessary extern, which
Andrew Innes <andrewi@gnu.org>
parents:
30703
diff
changeset
|
27 #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
|
28 extern int errno; |
31100
92f108b8b281
[USE_CRT_DLL]: Remove unnecessary extern, which
Andrew Innes <andrewi@gnu.org>
parents:
30703
diff
changeset
|
29 #endif |
2286
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
30 |
296 | 31 /* Define SIGCHLD as an alias for SIGCLD. */ |
32 | |
33 #if !defined (SIGCHLD) && defined (SIGCLD) | |
34 #define SIGCHLD SIGCLD | |
35 #endif /* SIGCLD */ | |
36 | |
37 #include <sys/types.h> | |
3932
9a411d86ca72
(PRIO_PROCESS): Definition deleted.
Richard M. Stallman <rms@gnu.org>
parents:
3826
diff
changeset
|
38 |
25767
30ffae737755
(toplevel) [HAVE_UNISTD_H]: Include unistd.h.
Gerd Moellmann <gerd@gnu.org>
parents:
25645
diff
changeset
|
39 #ifdef HAVE_UNISTD_H |
30ffae737755
(toplevel) [HAVE_UNISTD_H]: Include unistd.h.
Gerd Moellmann <gerd@gnu.org>
parents:
25645
diff
changeset
|
40 #include <unistd.h> |
30ffae737755
(toplevel) [HAVE_UNISTD_H]: Include unistd.h.
Gerd Moellmann <gerd@gnu.org>
parents:
25645
diff
changeset
|
41 #endif |
30ffae737755
(toplevel) [HAVE_UNISTD_H]: Include unistd.h.
Gerd Moellmann <gerd@gnu.org>
parents:
25645
diff
changeset
|
42 |
296 | 43 #include <sys/file.h> |
51403 | 44 #ifdef HAVE_FCNTL_H |
6818
6a9b0b5399ce
If we include fcntl.h, define INCLUDED_FCNTL.
Richard M. Stallman <rms@gnu.org>
parents:
6614
diff
changeset
|
45 #define INCLUDED_FCNTL |
296 | 46 #include <fcntl.h> |
47 #endif | |
48 | |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
49 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
50 #define NOMINMAX |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
51 #include <windows.h> |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
52 #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
|
53 #include <fcntl.h> |
16593
4ed80eda6fac
Use new names for w32 files
Geoff Voelker <voelker@cs.washington.edu>
parents:
16486
diff
changeset
|
54 #include "w32.h" |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
55 #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
|
56 #endif |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
57 |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
58 #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
|
59 #define INCLUDED_FCNTL |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
60 #include <fcntl.h> |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
61 #include <sys/stat.h> |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
62 #include <sys/param.h> |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
63 #include <errno.h> |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
64 #endif /* MSDOS */ |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
65 |
296 | 66 #ifndef O_RDONLY |
67 #define O_RDONLY 0 | |
68 #endif | |
69 | |
70 #ifndef O_WRONLY | |
71 #define O_WRONLY 1 | |
72 #endif | |
73 | |
74 #include "lisp.h" | |
75 #include "commands.h" | |
76 #include "buffer.h" | |
88356
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
77 #include "character.h" |
23885 | 78 #include "ccl.h" |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
79 #include "coding.h" |
29273 | 80 #include "composite.h" |
24412
d11ac02f9d6a
Use epaths.h istead of paths.h.
Richard M. Stallman <rms@gnu.org>
parents:
23885
diff
changeset
|
81 #include <epaths.h> |
296 | 82 #include "process.h" |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
83 #include "syssignal.h" |
5348 | 84 #include "systty.h" |
57892 | 85 #include "blockinput.h" |
83421
bb2edc915032
Implement automatic terminal-local environment variables via `local-environment-variables'.
Karoly Lorentey <lorentey@elte.hu>
parents:
64770
diff
changeset
|
86 #include "frame.h" |
bb2edc915032
Implement automatic terminal-local environment variables via `local-environment-variables'.
Karoly Lorentey <lorentey@elte.hu>
parents:
64770
diff
changeset
|
87 #include "termhooks.h" |
296 | 88 |
21786
5f8f1b124f45
nclude msdos.h after lisp.h.
Eli Zaretskii <eliz@gnu.org>
parents:
21694
diff
changeset
|
89 #ifdef MSDOS |
5f8f1b124f45
nclude msdos.h after lisp.h.
Eli Zaretskii <eliz@gnu.org>
parents:
21694
diff
changeset
|
90 #include "msdos.h" |
5f8f1b124f45
nclude msdos.h after lisp.h.
Eli Zaretskii <eliz@gnu.org>
parents:
21694
diff
changeset
|
91 #endif |
5f8f1b124f45
nclude msdos.h after lisp.h.
Eli Zaretskii <eliz@gnu.org>
parents:
21694
diff
changeset
|
92 |
31100
92f108b8b281
[USE_CRT_DLL]: Remove unnecessary extern, which
Andrew Innes <andrewi@gnu.org>
parents:
30703
diff
changeset
|
93 #ifndef USE_CRT_DLL |
296 | 94 extern char **environ; |
95 #endif | |
96 | |
29125
63520d6017fb
(setpgrp) [HAVE_SETPGID]: Define as setpgid.
Gerd Moellmann <gerd@gnu.org>
parents:
29000
diff
changeset
|
97 #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
|
98 #if !defined (USG) || defined (BSD_PGRPS) |
29905
ca781f54ac48
(setpgrp): Undefine before defining.
Dave Love <fx@gnu.org>
parents:
29287
diff
changeset
|
99 #undef setpgrp |
29125
63520d6017fb
(setpgrp) [HAVE_SETPGID]: Define as setpgid.
Gerd Moellmann <gerd@gnu.org>
parents:
29000
diff
changeset
|
100 #define setpgrp setpgid |
63520d6017fb
(setpgrp) [HAVE_SETPGID]: Define as setpgid.
Gerd Moellmann <gerd@gnu.org>
parents:
29000
diff
changeset
|
101 #endif |
29150
0398ec3316c5
(setpgrp): Don't define if USG and BSD_PGRPS are not defined.
Gerd Moellmann <gerd@gnu.org>
parents:
29125
diff
changeset
|
102 #endif |
29125
63520d6017fb
(setpgrp) [HAVE_SETPGID]: Define as setpgid.
Gerd Moellmann <gerd@gnu.org>
parents:
29000
diff
changeset
|
103 |
39811
9f7e72fba3d2
(Vexec_suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39535
diff
changeset
|
104 Lisp_Object Vexec_path, Vexec_directory, Vexec_suffixes; |
9f7e72fba3d2
(Vexec_suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39535
diff
changeset
|
105 Lisp_Object Vdata_directory, Vdoc_directory; |
45092
7f1d09693ef3
(Vgame_score_directory): Renamed to Vshared_game_score_directory.
Colin Walters <walters@gnu.org>
parents:
45002
diff
changeset
|
106 Lisp_Object Vconfigure_info_directory, Vshared_game_score_directory; |
101664
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
107 |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
108 /* Pattern used by call-process-region to make temp files. */ |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
109 static Lisp_Object Vtemp_file_name_pattern; |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
110 |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
111 extern Lisp_Object Vtemporary_file_directory; |
296 | 112 |
113 Lisp_Object Vshell_file_name; | |
114 | |
83796
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
115 Lisp_Object Vprocess_environment, Vinitial_environment; |
296 | 116 |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
117 #ifdef DOS_NT |
7397
e0ffa47f2ed4
[MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents:
7161
diff
changeset
|
118 Lisp_Object Qbuffer_file_type; |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
119 #endif /* DOS_NT */ |
7397
e0ffa47f2ed4
[MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents:
7161
diff
changeset
|
120 |
78501 | 121 /* True if we are about to fork off a synchronous process or if we |
296 | 122 are waiting for it. */ |
123 int synch_process_alive; | |
124 | |
125 /* Nonzero => this is a string explaining death of synchronous subprocess. */ | |
126 char *synch_process_death; | |
127 | |
53712
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
128 /* Nonzero => this is the signal number that terminated the subprocess. */ |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
129 int synch_process_termsig; |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
130 |
296 | 131 /* If synch_process_death is zero, |
132 this is exit code of synchronous subprocess. */ | |
133 int synch_process_retcode; | |
83421
bb2edc915032
Implement automatic terminal-local environment variables via `local-environment-variables'.
Karoly Lorentey <lorentey@elte.hu>
parents:
64770
diff
changeset
|
134 |
296 | 135 |
6275
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
136 /* 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
|
137 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
|
138 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
|
139 |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
140 /* 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
|
141 static int call_process_exited; |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
142 |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
143 EXFUN (Fgetenv_internal, 2); |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
144 |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
145 static Lisp_Object |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
146 call_process_kill (fdpid) |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
147 Lisp_Object fdpid; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
148 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
149 emacs_close (XFASTINT (Fcar (fdpid))); |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
150 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
|
151 synch_process_alive = 0; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
152 return Qnil; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
153 } |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
154 |
296 | 155 Lisp_Object |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
156 call_process_cleanup (arg) |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
157 Lisp_Object arg; |
296 | 158 { |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
159 Lisp_Object fdpid = Fcdr (arg); |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
160 #if defined (MSDOS) |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
161 Lisp_Object file; |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
162 #else |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
163 int pid; |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
164 #endif |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
165 |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
166 Fset_buffer (Fcar (arg)); |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
167 |
87730 | 168 #if defined (MSDOS) |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
169 /* 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
|
170 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
|
171 emacs_close (XFASTINT (Fcar (fdpid))); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
172 if (strcmp (SDATA (file), NULL_DEVICE) != 0) |
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
173 unlink (SDATA (file)); |
87730 | 174 #else /* not MSDOS */ |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
175 pid = XFASTINT (Fcdr (fdpid)); |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
176 |
6275
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
177 if (call_process_exited) |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
178 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
179 emacs_close (XFASTINT (Fcar (fdpid))); |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
180 return Qnil; |
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
181 } |
6275
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
182 |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
183 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
|
184 { |
46293
1fb8f75062c6
Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
46260
diff
changeset
|
185 int count = SPECPDL_INDEX (); |
1504
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
186 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
|
187 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
|
188 immediate_quit = 1; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
189 QUIT; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
190 wait_for_termination (pid); |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
191 immediate_quit = 0; |
e074a2236b00
* callproc.c: Arrange for synchronous processes to get SIGINT the
Jim Blandy <jimb@redhat.com>
parents:
1201
diff
changeset
|
192 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
|
193 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
|
194 } |
296 | 195 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
|
196 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
|
197 #endif /* not MSDOS */ |
296 | 198 return Qnil; |
199 } | |
200 | |
201 DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0, | |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
202 doc: /* Call PROGRAM synchronously in separate process. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
203 The remaining arguments are optional. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
204 The program's input comes from file INFILE (nil means `/dev/null'). |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
205 Insert output in BUFFER before point; t means current buffer; |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
206 nil for BUFFER means discard it; 0 means discard and don't wait. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
207 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
208 REAL-BUFFER says what to do with standard output, as above, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
209 while STDERR-FILE says what to do with standard error in the child. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
210 STDERR-FILE may be nil (discard standard error output), |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
211 t (mix it with ordinary output), or a file name string. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
212 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
213 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
214 Remaining arguments are strings passed as command arguments to PROGRAM. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
215 |
71340
5de9b904c7ad
(Fcall_process): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
70705
diff
changeset
|
216 If executable PROGRAM can't be found as an executable, `call-process' |
5de9b904c7ad
(Fcall_process): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
70705
diff
changeset
|
217 signals a Lisp error. `call-process' reports errors in execution of |
5de9b904c7ad
(Fcall_process): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
70705
diff
changeset
|
218 the program only through its return and output. |
5de9b904c7ad
(Fcall_process): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
70705
diff
changeset
|
219 |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
220 If BUFFER is 0, `call-process' returns immediately with value nil. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
221 Otherwise it waits for PROGRAM to terminate |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
222 and returns a numeric exit status or a signal description string. |
40114
c8af574bcf48
(Fcall_process_region, Fcall_process): Add usage: string to doc string.
Miles Bader <miles@gnu.org>
parents:
40103
diff
changeset
|
223 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. |
c8af574bcf48
(Fcall_process_region, Fcall_process): Add usage: string to doc string.
Miles Bader <miles@gnu.org>
parents:
40103
diff
changeset
|
224 |
c8af574bcf48
(Fcall_process_region, Fcall_process): Add usage: string to doc string.
Miles Bader <miles@gnu.org>
parents:
40103
diff
changeset
|
225 usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
226 (nargs, args) |
296 | 227 int nargs; |
228 register Lisp_Object *args; | |
229 { | |
57473
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
230 Lisp_Object infile, buffer, current_dir, path; |
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
231 int display_p; |
296 | 232 int fd[2]; |
233 int filefd; | |
234 register int pid; | |
62982
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
235 #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024) |
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
236 #define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN) |
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
237 char buf[CALLPROC_BUFFER_SIZE_MAX]; |
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
238 int bufsize = CALLPROC_BUFFER_SIZE_MIN; |
46293
1fb8f75062c6
Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
46260
diff
changeset
|
239 int count = SPECPDL_INDEX (); |
20525
468f59c6c9bf
(Fcall_process): Cast new_argv for child_setup.
Richard M. Stallman <rms@gnu.org>
parents:
20448
diff
changeset
|
240 |
98089
4ea0f5996bd5
(Fcall_process): Don't hold references to string data
Andreas Schwab <schwab@suse.de>
parents:
98083
diff
changeset
|
241 register const unsigned char **new_argv; |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
242 /* 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
|
243 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
|
244 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
|
245 #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
|
246 char *outf, *tempfile; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
247 int outfilefd; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
248 #endif |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
249 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
|
250 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
|
251 /* 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
|
252 Lisp_Object coding_systems; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
253 |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
254 /* 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
|
255 coding_systems = Qt; |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
256 |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40114
diff
changeset
|
257 CHECK_STRING (args[0]); |
296 | 258 |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
259 error_file = Qt; |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
260 |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
261 #ifndef subprocesses |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
262 /* Without asynchronous processes we cannot have BUFFER == 0. */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
263 if (nargs >= 3 |
22639
8177901b437a
(Fcall_process) [! subprocesses]: Balance parentheses in an if clause.
Eli Zaretskii <eliz@gnu.org>
parents:
22550
diff
changeset
|
264 && (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
|
265 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
|
266 #endif /* subprocesses */ |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
267 |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
268 /* Decide the coding-system for giving arguments. */ |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
269 { |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
270 Lisp_Object val, *args2; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
271 int i; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
272 |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
273 /* 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
|
274 if (nargs >= 5) |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
275 { |
20595
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
276 int must_encode = 0; |
90434
8c71fed372cf
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90393
diff
changeset
|
277 Lisp_Object coding_attrs; |
20595
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
278 |
20789
140b6fdd53d0
(Fcall_process): Test only args past args[4] for multibyteness.
Richard M. Stallman <rms@gnu.org>
parents:
20724
diff
changeset
|
279 for (i = 4; i < nargs; i++) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40114
diff
changeset
|
280 CHECK_STRING (args[i]); |
22940
3cfe86230c87
(Fcall_process): Check type of process cmd args earlier on.
Richard M. Stallman <rms@gnu.org>
parents:
22792
diff
changeset
|
281 |
3cfe86230c87
(Fcall_process): Check type of process cmd args earlier on.
Richard M. Stallman <rms@gnu.org>
parents:
22792
diff
changeset
|
282 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
|
283 if (STRING_MULTIBYTE (args[i])) |
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
284 must_encode = 1; |
7d5ca0b58282
(Fcall_process): When deciding whether to encode args,
Richard M. Stallman <rms@gnu.org>
parents:
20525
diff
changeset
|
285 |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
286 if (!NILP (Vcoding_system_for_write)) |
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
287 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
|
288 else if (! must_encode) |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
289 val = Qnil; |
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
290 else |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
291 { |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
292 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
293 args2[0] = Qcall_process; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
294 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
|
295 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
|
296 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
|
297 val = XCDR (coding_systems); |
18182
967f92654591
(Fcall_process): Pay attention to
Kenichi Handa <handa@m17n.org>
parents:
17729
diff
changeset
|
298 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
|
299 val = XCDR (Vdefault_process_coding_system); |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
300 else |
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
301 val = Qnil; |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
302 } |
90393
6592da24d351
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90389
diff
changeset
|
303 val = coding_inherit_eol_type (val, Qnil); |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
304 setup_coding_system (Fcheck_coding_system (val), &argument_coding); |
90434
8c71fed372cf
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90393
diff
changeset
|
305 coding_attrs = CODING_ID_ATTRS (argument_coding.id); |
8c71fed372cf
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90393
diff
changeset
|
306 if (NILP (CODING_ATTR_ASCII_COMPAT (coding_attrs))) |
8c71fed372cf
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90393
diff
changeset
|
307 { |
8c71fed372cf
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90393
diff
changeset
|
308 /* We should not use an ASCII incompatible coding system. */ |
8c71fed372cf
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90393
diff
changeset
|
309 val = raw_text_coding_system (val); |
8c71fed372cf
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90393
diff
changeset
|
310 setup_coding_system (val, &argument_coding); |
8c71fed372cf
(Fcall_process): Sync with HEAD.
Kenichi Handa <handa@m17n.org>
parents:
90393
diff
changeset
|
311 } |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
312 } |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
313 } |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
314 |
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
|
315 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
|
316 { |
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
317 infile = Fexpand_file_name (args[1], current_buffer->directory); |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40114
diff
changeset
|
318 CHECK_STRING (infile); |
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
|
319 } |
296 | 320 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
|
321 infile = build_string (NULL_DEVICE); |
648 | 322 |
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
|
323 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
|
324 { |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
325 buffer = args[2]; |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
326 |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
327 /* 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
|
328 (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
|
329 if (CONSP (buffer)) |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
330 { |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
331 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
|
332 { |
15473
cdf40972804f
(Fcall_process): Fix previous change.
Richard M. Stallman <rms@gnu.org>
parents:
15440
diff
changeset
|
333 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
|
334 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
|
335 |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
336 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
|
337 error_file = stderr_file; |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
338 else |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
339 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
|
340 } |
87c6c9287f45
(Fcall_process): Handle t or nil as STDERR_FILE.
Richard M. Stallman <rms@gnu.org>
parents:
15236
diff
changeset
|
341 |
25645
a14111a2a100
Use XCAR, XCDR, XFLOAT_DATA instead of explicit member access.
Ken Raeburn <raeburn@raeburn.org>
parents:
25522
diff
changeset
|
342 buffer = XCAR (buffer); |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
343 } |
296 | 344 |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
345 if (!(EQ (buffer, Qnil) |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
346 || EQ (buffer, Qt) |
22550
4ec5c343db1f
(Fcall_process): Handle third argument BUFFER
Richard M. Stallman <rms@gnu.org>
parents:
22373
diff
changeset
|
347 || 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
|
348 { |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
349 Lisp_Object spec_buffer; |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
350 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
|
351 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
|
352 /* 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
|
353 if (NILP (buffer)) |
40656
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40114
diff
changeset
|
354 CHECK_BUFFER (spec_buffer); |
cdfd4d09b79a
Update usage of CHECK_ macros (remove unused second argument).
Pavel Janík <Pavel@Janik.cz>
parents:
40114
diff
changeset
|
355 CHECK_BUFFER (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
|
356 } |
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
357 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
358 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
|
359 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
|
360 |
1678
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
361 /* 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
|
362 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
|
363 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
|
364 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
|
365 |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
366 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
|
367 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
|
368 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
|
369 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
|
370 buffer. */ |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
371 { |
68389
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
372 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
1678
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
373 |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
374 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
|
375 |
68389
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
376 GCPRO4 (infile, buffer, current_dir, error_file); |
1678
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
377 |
91551
f14242124fd7
* process.c (Fstart_process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91367
diff
changeset
|
378 current_dir = Funhandled_file_name_directory (current_dir); |
f14242124fd7
* process.c (Fstart_process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91367
diff
changeset
|
379 if (NILP (current_dir)) |
f14242124fd7
* process.c (Fstart_process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91367
diff
changeset
|
380 /* If the file name handler says that current_dir is unreachable, use |
f14242124fd7
* process.c (Fstart_process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91367
diff
changeset
|
381 a sensible default. */ |
f14242124fd7
* process.c (Fstart_process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91367
diff
changeset
|
382 current_dir = build_string ("~/"); |
f14242124fd7
* process.c (Fstart_process):
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
91367
diff
changeset
|
383 current_dir = expand_and_dir_to_file (current_dir, Qnil); |
98083
78f10c77413c
(Fcall_process): Canonicalize current directory name.
Chong Yidong <cyd@stupidchicken.com>
parents:
97142
diff
changeset
|
384 current_dir = Ffile_name_as_directory (current_dir); |
78f10c77413c
(Fcall_process): Canonicalize current directory name.
Chong Yidong <cyd@stupidchicken.com>
parents:
97142
diff
changeset
|
385 |
1678
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
386 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
|
387 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
|
388 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
|
389 |
68389
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
390 if (STRING_MULTIBYTE (infile)) |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
391 infile = ENCODE_FILE (infile); |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
392 if (STRING_MULTIBYTE (current_dir)) |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
393 current_dir = ENCODE_FILE (current_dir); |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
394 if (STRINGP (error_file) && STRING_MULTIBYTE (error_file)) |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
395 error_file = ENCODE_FILE (error_file); |
1678
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
396 UNGCPRO; |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
397 } |
62ecf0c5b54c
Give subprocess creation a way to find a valid current directory
Jim Blandy <jimb@redhat.com>
parents:
1596
diff
changeset
|
398 |
57473
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
399 display_p = INTERACTIVE && nargs >= 4 && !NILP (args[3]); |
296 | 400 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
401 filefd = emacs_open (SDATA (infile), O_RDONLY, 0); |
6391
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
402 if (filefd < 0) |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
403 { |
68389
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
404 infile = DECODE_FILE (infile); |
6391
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
405 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
|
406 } |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
407 /* Search for program; barf if not found. */ |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
408 { |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
409 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
6391
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
410 |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
411 GCPRO4 (infile, buffer, current_dir, error_file); |
45002
f1eb7c3e1e04
(Fcall_process): Update call to openp.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
44992
diff
changeset
|
412 openp (Vexec_path, args[0], Vexec_suffixes, &path, make_number (X_OK)); |
6391
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
413 UNGCPRO; |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
414 } |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
415 if (NILP (path)) |
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
416 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
417 emacs_close (filefd); |
6391
d4fe8a853557
(Fcall_process): GCPRO some things.
Karl Heuer <kwzh@gnu.org>
parents:
6275
diff
changeset
|
418 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
|
419 } |
47018
101eb25eab6d
(Fcall_process): Remove /: from program name.
Richard M. Stallman <rms@gnu.org>
parents:
46626
diff
changeset
|
420 |
101eb25eab6d
(Fcall_process): Remove /: from program name.
Richard M. Stallman <rms@gnu.org>
parents:
46626
diff
changeset
|
421 /* If program file name starts with /: for quoting a magic name, |
101eb25eab6d
(Fcall_process): Remove /: from program name.
Richard M. Stallman <rms@gnu.org>
parents:
46626
diff
changeset
|
422 discard that. */ |
101eb25eab6d
(Fcall_process): Remove /: from program name.
Richard M. Stallman <rms@gnu.org>
parents:
46626
diff
changeset
|
423 if (SBYTES (path) > 2 && SREF (path, 0) == '/' |
101eb25eab6d
(Fcall_process): Remove /: from program name.
Richard M. Stallman <rms@gnu.org>
parents:
46626
diff
changeset
|
424 && SREF (path, 1) == ':') |
101eb25eab6d
(Fcall_process): Remove /: from program name.
Richard M. Stallman <rms@gnu.org>
parents:
46626
diff
changeset
|
425 path = Fsubstring (path, make_number (2), Qnil); |
101eb25eab6d
(Fcall_process): Remove /: from program name.
Richard M. Stallman <rms@gnu.org>
parents:
46626
diff
changeset
|
426 |
98089
4ea0f5996bd5
(Fcall_process): Don't hold references to string data
Andreas Schwab <schwab@suse.de>
parents:
98083
diff
changeset
|
427 new_argv = (const unsigned char **) |
4ea0f5996bd5
(Fcall_process): Don't hold references to string data
Andreas Schwab <schwab@suse.de>
parents:
98083
diff
changeset
|
428 alloca (max (2, nargs - 2) * sizeof (char *)); |
20230
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
429 if (nargs > 4) |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
430 { |
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
431 register int i; |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
432 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
433 |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
434 GCPRO5 (infile, buffer, current_dir, path, error_file); |
29000
f5c7d80ed4de
(Fcall_process): Always encode an argument string if
Kenichi Handa <handa@m17n.org>
parents:
28914
diff
changeset
|
435 argument_coding.dst_multibyte = 0; |
f5c7d80ed4de
(Fcall_process): Always encode an argument string if
Kenichi Handa <handa@m17n.org>
parents:
28914
diff
changeset
|
436 for (i = 4; i < nargs; i++) |
f5c7d80ed4de
(Fcall_process): Always encode an argument string if
Kenichi Handa <handa@m17n.org>
parents:
28914
diff
changeset
|
437 { |
f5c7d80ed4de
(Fcall_process): Always encode an argument string if
Kenichi Handa <handa@m17n.org>
parents:
28914
diff
changeset
|
438 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
|
439 if (CODING_REQUIRE_ENCODING (&argument_coding)) |
88356
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
440 /* We must encode this argument. */ |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
441 args[i] = encode_coding_string (&argument_coding, args[i], 1); |
20230
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
442 } |
29000
f5c7d80ed4de
(Fcall_process): Always encode an argument string if
Kenichi Handa <handa@m17n.org>
parents:
28914
diff
changeset
|
443 UNGCPRO; |
98089
4ea0f5996bd5
(Fcall_process): Don't hold references to string data
Andreas Schwab <schwab@suse.de>
parents:
98083
diff
changeset
|
444 for (i = 4; i < nargs; i++) |
4ea0f5996bd5
(Fcall_process): Don't hold references to string data
Andreas Schwab <schwab@suse.de>
parents:
98083
diff
changeset
|
445 new_argv[i - 3] = SDATA (args[i]); |
4ea0f5996bd5
(Fcall_process): Don't hold references to string data
Andreas Schwab <schwab@suse.de>
parents:
98083
diff
changeset
|
446 new_argv[i - 3] = 0; |
20230
ad33fb40e5e7
(Fcall_process): GCPRO infile, buffer, and
Kenichi Handa <handa@m17n.org>
parents:
20041
diff
changeset
|
447 } |
20448
afef187a070b
(Fcall_process): Don't clobber new_argv[0]
Karl Heuer <kwzh@gnu.org>
parents:
20436
diff
changeset
|
448 else |
afef187a070b
(Fcall_process): Don't clobber new_argv[0]
Karl Heuer <kwzh@gnu.org>
parents:
20436
diff
changeset
|
449 new_argv[1] = 0; |
98089
4ea0f5996bd5
(Fcall_process): Don't hold references to string data
Andreas Schwab <schwab@suse.de>
parents:
98083
diff
changeset
|
450 new_argv[0] = SDATA (path); |
296 | 451 |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
452 #ifdef MSDOS /* MW, July 1993 */ |
23462
aaad8461ff34
(Fcall_process): Use $TMPDIR instead of trying $TMP
Eli Zaretskii <eliz@gnu.org>
parents:
23079
diff
changeset
|
453 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
|
454 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
|
455 else |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
456 { |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
457 tempfile = alloca (20); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
458 *tempfile = '\0'; |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
459 } |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
460 dostounix_filename (tempfile); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
461 if (*tempfile == '\0' || 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
|
462 strcat (tempfile, "/"); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
463 strcat (tempfile, "detmp.XXX"); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
464 mktemp (tempfile); |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
465 |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
466 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
|
467 if (outfilefd < 0) |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
468 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
469 emacs_close (filefd); |
15610 | 470 report_file_error ("Opening process output file", |
471 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
|
472 } |
15610 | 473 fd[0] = filefd; |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
474 fd[1] = outfilefd; |
15610 | 475 #endif /* MSDOS */ |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
476 |
9138
6c814eb4d892
(Fcall_process, child_setup, getenv_internal): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8853
diff
changeset
|
477 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
|
478 fd[1] = emacs_open (NULL_DEVICE, O_WRONLY, 0), fd[0] = -1; |
296 | 479 else |
480 { | |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
481 #ifndef MSDOS |
87732
d3276439c0d3
(Fcall_process): Fix previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87730
diff
changeset
|
482 errno = 0; |
d3276439c0d3
(Fcall_process): Fix previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87730
diff
changeset
|
483 if (pipe (fd) == -1) |
d3276439c0d3
(Fcall_process): Fix previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87730
diff
changeset
|
484 { |
d3276439c0d3
(Fcall_process): Fix previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87730
diff
changeset
|
485 emacs_close (filefd); |
d3276439c0d3
(Fcall_process): Fix previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87730
diff
changeset
|
486 report_file_error ("Creating process pipe", Qnil); |
d3276439c0d3
(Fcall_process): Fix previous change.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
87730
diff
changeset
|
487 } |
25522
c675d8210bda
(call-process) [macintosh]: Call mac_run_command in
Richard M. Stallman <rms@gnu.org>
parents:
25521
diff
changeset
|
488 #endif |
296 | 489 } |
490 | |
491 { | |
492 /* child_setup must clobber environ in systems with true vfork. | |
493 Protect it from permanent change. */ | |
494 register char **save_environ = environ; | |
495 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
|
496 int fd_error = fd1; |
296 | 497 |
498 #if 0 /* Some systems don't have sigblock. */ | |
638 | 499 mask = sigblock (sigmask (SIGCHLD)); |
296 | 500 #endif |
501 | |
502 /* Record that we're about to create a synchronous process. */ | |
503 synch_process_alive = 1; | |
504 | |
4977
81c44a01ddda
(Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents:
4701
diff
changeset
|
505 /* 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
|
506 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
|
507 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
|
508 synch_process_death = 0; |
81c44a01ddda
(Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents:
4701
diff
changeset
|
509 synch_process_retcode = 0; |
53712
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
510 synch_process_termsig = 0; |
4977
81c44a01ddda
(Fcall_process): Clear synch_process_death and
Richard M. Stallman <rms@gnu.org>
parents:
4701
diff
changeset
|
511 |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
512 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
|
513 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
|
514 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
|
515 { |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
516 #ifdef DOS_NT |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
517 fd_error = emacs_open (SDATA (error_file), |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
518 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
|
519 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
|
520 #else /* not DOS_NT */ |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
521 fd_error = creat (SDATA (error_file), 0666); |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
522 #endif /* not DOS_NT */ |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
523 } |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
524 |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
525 if (fd_error < 0) |
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
526 { |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
527 emacs_close (filefd); |
15610 | 528 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
|
529 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
|
530 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
|
531 emacs_close (fd1); |
15610 | 532 #ifdef MSDOS |
533 unlink (tempfile); | |
534 #endif | |
68389
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
535 if (NILP (error_file)) |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
536 error_file = build_string (NULL_DEVICE); |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
537 else if (STRINGP (error_file)) |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
538 error_file = DECODE_FILE (error_file); |
ee72dfb5a3cd
(Fcall_process): GCPRO error_file. Encode infile,
Kenichi Handa <handa@m17n.org>
parents:
67989
diff
changeset
|
539 report_file_error ("Cannot redirect stderr", Fcons (error_file, Qnil)); |
10839
2e3eae2280eb
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
10083
diff
changeset
|
540 } |
19838
7e1bbe58eb02
(Fcall_process): Encode the new current dir.
Richard M. Stallman <rms@gnu.org>
parents:
19790
diff
changeset
|
541 |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
542 #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
|
543 /* 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
|
544 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
|
545 below. */ |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
546 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
|
547 0, current_dir); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
548 |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
549 /* 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
|
550 termination status. */ |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
551 synch_process_alive = 0; |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
552 synch_process_retcode = pid; |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
553 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
|
554 { |
26526
b7438760079b
* callproc.c (strerror): Remove decl.
Paul Eggert <eggert@twinsun.com>
parents:
26088
diff
changeset
|
555 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
|
556 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
|
557 } |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
558 |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
559 emacs_close (outfilefd); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
560 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
|
561 emacs_close (fd_error); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
562 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
|
563 /* 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
|
564 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
|
565 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
|
566 if (fd[0] < 0) |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
567 { |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
568 unlink (tempfile); |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
569 emacs_close (filefd); |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
570 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
|
571 } |
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
572 #else /* not MSDOS */ |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
573 #ifdef WINDOWSNT |
20525
468f59c6c9bf
(Fcall_process): Cast new_argv for child_setup.
Richard M. Stallman <rms@gnu.org>
parents:
20448
diff
changeset
|
574 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
|
575 0, current_dir); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
576 #else /* not WINDOWSNT */ |
57892 | 577 BLOCK_INPUT; |
578 | |
296 | 579 pid = vfork (); |
580 | |
581 if (pid == 0) | |
582 { | |
583 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
|
584 emacs_close (fd[0]); |
18235
43ce16d5f31e
(Fcall_process): Use setsid to disconnect child
Richard M. Stallman <rms@gnu.org>
parents:
18182
diff
changeset
|
585 #ifdef HAVE_SETSID |
43ce16d5f31e
(Fcall_process): Use setsid to disconnect child
Richard M. Stallman <rms@gnu.org>
parents:
18182
diff
changeset
|
586 setsid (); |
43ce16d5f31e
(Fcall_process): Use setsid to disconnect child
Richard M. Stallman <rms@gnu.org>
parents:
18182
diff
changeset
|
587 #endif |
43ce16d5f31e
(Fcall_process): Use setsid to disconnect child
Richard M. Stallman <rms@gnu.org>
parents:
18182
diff
changeset
|
588 #if defined (USG) && !defined (BSD_PGRPS) |
296 | 589 setpgrp (); |
590 #else | |
591 setpgrp (pid, pid); | |
592 #endif /* USG */ | |
20525
468f59c6c9bf
(Fcall_process): Cast new_argv for child_setup.
Richard M. Stallman <rms@gnu.org>
parents:
20448
diff
changeset
|
593 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
|
594 0, current_dir); |
296 | 595 } |
57892 | 596 |
597 UNBLOCK_INPUT; | |
13719
660032b84b23
(Fcall_process) [MSDOS]: Support redirection of
Karl Heuer <kwzh@gnu.org>
parents:
12854
diff
changeset
|
598 #endif /* not WINDOWSNT */ |
15225
a78a1df9690c
(Fcall_process): Fix previous change (now !MSDOS only).
Richard M. Stallman <rms@gnu.org>
parents:
15210
diff
changeset
|
599 |
a78a1df9690c
(Fcall_process): Fix previous change (now !MSDOS only).
Richard M. Stallman <rms@gnu.org>
parents:
15210
diff
changeset
|
600 /* 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
|
601 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
|
602 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
|
603 #endif /* not MSDOS */ |
296 | 604 |
605 environ = save_environ; | |
606 | |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
607 /* 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
|
608 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
|
609 emacs_close (filefd); |
15236
99d01b1b8799
(Fcall_process): Don't close the same fd twice.
Karl Heuer <kwzh@gnu.org>
parents:
15225
diff
changeset
|
610 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
|
611 emacs_close (fd1); |
296 | 612 } |
613 | |
614 if (pid < 0) | |
615 { | |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
616 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
|
617 emacs_close (fd[0]); |
296 | 618 report_file_error ("Doing vfork", Qnil); |
619 } | |
620 | |
9138
6c814eb4d892
(Fcall_process, child_setup, getenv_internal): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8853
diff
changeset
|
621 if (INTEGERP (buffer)) |
296 | 622 { |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
623 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
|
624 emacs_close (fd[0]); |
296 | 625 #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
|
626 /* 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
|
627 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
|
628 the facilities for handling SIGCHLD. */ |
296 | 629 wait_without_blocking (); |
630 #endif /* subprocesses */ | |
631 return Qnil; | |
632 } | |
633 | |
6466
4b3c537e1169
(Fcall_process): Make sure to close descriptors.
Richard M. Stallman <rms@gnu.org>
parents:
6391
diff
changeset
|
634 /* 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
|
635 call_process_exited = 0; |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
636 |
87730 | 637 #if defined(MSDOS) |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
638 /* 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
|
639 record_unwind_protect (call_process_cleanup, |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
640 Fcons (Fcurrent_buffer (), |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
641 Fcons (make_number (fd[0]), |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
642 build_string (tempfile)))); |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
643 #else |
296 | 644 record_unwind_protect (call_process_cleanup, |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
645 Fcons (Fcurrent_buffer (), |
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
646 Fcons (make_number (fd[0]), make_number (pid)))); |
87730 | 647 #endif /* not MSDOS */ |
296 | 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 (BUFFERP (buffer)) |
296 | 651 Fset_buffer (buffer); |
652 | |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
653 if (NILP (buffer)) |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
654 { |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
655 /* 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
|
656 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
|
657 setup_coding_system (Qnil, &process_coding); |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
658 } |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
659 else |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
660 { |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
661 Lisp_Object val, *args2; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
662 |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
663 val = Qnil; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
664 if (!NILP (Vcoding_system_for_read)) |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
665 val = Vcoding_system_for_read; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
666 else |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
667 { |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
668 if (EQ (coding_systems, Qt)) |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
669 { |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
670 int i; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
671 |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
672 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
|
673 args2[0] = Qcall_process; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
674 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
|
675 coding_systems |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
676 = 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
|
677 } |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
678 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
|
679 val = XCAR (coding_systems); |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
680 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
|
681 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
|
682 else |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
683 val = Qnil; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
684 } |
88356
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
685 Fcheck_coding_system (val); |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
686 /* 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
|
687 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
|
688 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
|
689 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
|
690 && !NILP (val)) |
88356
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
691 val = raw_text_coding_system (val); |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
692 setup_coding_system (val, &process_coding); |
24931
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 |
296 | 695 immediate_quit = 1; |
696 QUIT; | |
697 | |
698 { | |
699 register int nread; | |
5251
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
700 int first = 1; |
11619
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
701 int total_read = 0; |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
702 int carryover = 0; |
57473
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
703 int display_on_the_fly = display_p; |
22320
aed8bb8b8837
(Fcall_process): Avoid initializer on auto struct.
Karl Heuer <kwzh@gnu.org>
parents:
21997
diff
changeset
|
704 struct coding_system saved_coding; |
aed8bb8b8837
(Fcall_process): Avoid initializer on auto struct.
Karl Heuer <kwzh@gnu.org>
parents:
21997
diff
changeset
|
705 |
aed8bb8b8837
(Fcall_process): Avoid initializer on auto struct.
Karl Heuer <kwzh@gnu.org>
parents:
21997
diff
changeset
|
706 saved_coding = process_coding; |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
707 while (1) |
296 | 708 { |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
709 /* 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
|
710 of the buffer size we have. But don't read |
14036 | 711 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
|
712 nread = carryover; |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
713 while (nread < bufsize - 1024) |
8853
f44e40e722b2
(Fcall_process) [__osf__ && __alpha]:
Richard M. Stallman <rms@gnu.org>
parents:
8737
diff
changeset
|
714 { |
62982
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
715 int this_read = emacs_read (fd[0], buf + nread, |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
716 bufsize - nread); |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
717 |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
718 if (this_read < 0) |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
719 goto give_up; |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
720 |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
721 if (this_read == 0) |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
722 { |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
723 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
|
724 break; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
725 } |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
726 |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
727 nread += this_read; |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
728 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
|
729 |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
730 if (display_on_the_fly) |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
731 break; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
732 } |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
733 |
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
734 /* Now NREAD is the total amount of data in the buffer. */ |
296 | 735 immediate_quit = 0; |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
736 |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
737 if (!NILP (buffer)) |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
738 { |
88945
9c97427fb1f6
(Fcall_process): Don't call insert_1_both directly if
Kenichi Handa <handa@m17n.org>
parents:
88828
diff
changeset
|
739 if (NILP (current_buffer->enable_multibyte_characters) |
9c97427fb1f6
(Fcall_process): Don't call insert_1_both directly if
Kenichi Handa <handa@m17n.org>
parents:
88828
diff
changeset
|
740 && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) |
62982
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
741 insert_1_both (buf, nread, nread, 0, 1, 0); |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
742 else |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
743 { /* We have to decode the input. */ |
90190
d8a6a0474c49
(Fcall_process): Sync with the change in
Kenichi Handa <handa@m17n.org>
parents:
90188
diff
changeset
|
744 Lisp_Object curbuf; |
102360
f7043754fd19
(Fcall_process): Bind inhibit-modification-hooks to t when decoding
Eli Zaretskii <eliz@gnu.org>
parents:
101664
diff
changeset
|
745 int count1 = SPECPDL_INDEX (); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
746 |
90190
d8a6a0474c49
(Fcall_process): Sync with the change in
Kenichi Handa <handa@m17n.org>
parents:
90188
diff
changeset
|
747 XSETBUFFER (curbuf, current_buffer); |
102360
f7043754fd19
(Fcall_process): Bind inhibit-modification-hooks to t when decoding
Eli Zaretskii <eliz@gnu.org>
parents:
101664
diff
changeset
|
748 /* We cannot allow after-change-functions be run |
f7043754fd19
(Fcall_process): Bind inhibit-modification-hooks to t when decoding
Eli Zaretskii <eliz@gnu.org>
parents:
101664
diff
changeset
|
749 during decoding, because that might modify the |
f7043754fd19
(Fcall_process): Bind inhibit-modification-hooks to t when decoding
Eli Zaretskii <eliz@gnu.org>
parents:
101664
diff
changeset
|
750 buffer, while we rely on process_coding.produced to |
f7043754fd19
(Fcall_process): Bind inhibit-modification-hooks to t when decoding
Eli Zaretskii <eliz@gnu.org>
parents:
101664
diff
changeset
|
751 faithfully reflect inserted text until we |
f7043754fd19
(Fcall_process): Bind inhibit-modification-hooks to t when decoding
Eli Zaretskii <eliz@gnu.org>
parents:
101664
diff
changeset
|
752 TEMP_SET_PT_BOTH below. */ |
f7043754fd19
(Fcall_process): Bind inhibit-modification-hooks to t when decoding
Eli Zaretskii <eliz@gnu.org>
parents:
101664
diff
changeset
|
753 specbind (Qinhibit_modification_hooks, Qt); |
90190
d8a6a0474c49
(Fcall_process): Sync with the change in
Kenichi Handa <handa@m17n.org>
parents:
90188
diff
changeset
|
754 decode_coding_c_string (&process_coding, buf, nread, |
d8a6a0474c49
(Fcall_process): Sync with the change in
Kenichi Handa <handa@m17n.org>
parents:
90188
diff
changeset
|
755 curbuf); |
102360
f7043754fd19
(Fcall_process): Bind inhibit-modification-hooks to t when decoding
Eli Zaretskii <eliz@gnu.org>
parents:
101664
diff
changeset
|
756 unbind_to (count1, Qnil); |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
757 if (display_on_the_fly |
88356
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
758 && CODING_REQUIRE_DETECTION (&saved_coding) |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
759 && ! CODING_REQUIRE_DETECTION (&process_coding)) |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
760 { |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
761 /* 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
|
762 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
|
763 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
|
764 displaying on the fly. */ |
88356
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
765 if (process_coding.produced > 0) |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
766 del_range_2 (process_coding.dst_pos, |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
767 process_coding.dst_pos_byte, |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
768 process_coding.dst_pos |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
769 + process_coding.produced_char, |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
770 process_coding.dst_pos_byte |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
771 + process_coding.produced, 0); |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
772 display_on_the_fly = 0; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
773 process_coding = saved_coding; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
774 carryover = nread; |
57473
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
775 /* This is to make the above condition always |
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
776 fails in the future. */ |
90017
6e012bc03071
(Fcall_process): Fix merging of 2004-10-13 change.
Kenichi Handa <handa@m17n.org>
parents:
90016
diff
changeset
|
777 saved_coding.common_flags |
6e012bc03071
(Fcall_process): Fix merging of 2004-10-13 change.
Kenichi Handa <handa@m17n.org>
parents:
90016
diff
changeset
|
778 &= ~CODING_REQUIRE_DETECTION_MASK; |
21966
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
779 continue; |
10183730b250
(Fcall_process): If we must display received data on
Kenichi Handa <handa@m17n.org>
parents:
21786
diff
changeset
|
780 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
781 |
88454
47b395dd6f2c
(Fcall_process): Be sure to give the current buffer
Kenichi Handa <handa@m17n.org>
parents:
88356
diff
changeset
|
782 TEMP_SET_PT_BOTH (PT + process_coding.produced_char, |
47b395dd6f2c
(Fcall_process): Be sure to give the current buffer
Kenichi Handa <handa@m17n.org>
parents:
88356
diff
changeset
|
783 PT_BYTE + process_coding.produced); |
89461
108e326323e3
(Fcall_process): Handle carryover correctly.
Kenichi Handa <handa@m17n.org>
parents:
88945
diff
changeset
|
784 carryover = process_coding.carryover_bytes; |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
785 if (carryover > 0) |
29000
f5c7d80ed4de
(Fcall_process): Always encode an argument string if
Kenichi Handa <handa@m17n.org>
parents:
28914
diff
changeset
|
786 /* 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
|
787 better avoid overhead of bcopy. */ |
90190
d8a6a0474c49
(Fcall_process): Sync with the change in
Kenichi Handa <handa@m17n.org>
parents:
90188
diff
changeset
|
788 BCOPY_SHORT (process_coding.carryover, buf, |
89461
108e326323e3
(Fcall_process): Handle carryover correctly.
Kenichi Handa <handa@m17n.org>
parents:
88945
diff
changeset
|
789 process_coding.carryover_bytes); |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
790 } |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
791 } |
29000
f5c7d80ed4de
(Fcall_process): Always encode an argument string if
Kenichi Handa <handa@m17n.org>
parents:
28914
diff
changeset
|
792 |
20724
e34b99d443b1
(Fcall_process): Use raw-text instead of emacs-mule
Kenichi Handa <handa@m17n.org>
parents:
20595
diff
changeset
|
793 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
|
794 break; |
11619
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
795 |
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
796 /* Make the buffer bigger as we continue to read more data, |
62982
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
797 but not past CALLPROC_BUFFER_SIZE_MAX. */ |
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
798 if (bufsize < CALLPROC_BUFFER_SIZE_MAX && total_read > 32 * bufsize) |
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
799 if ((bufsize *= 2) > CALLPROC_BUFFER_SIZE_MAX) |
d7793ac6df62
(Fcall_process): Don't use alloca to gradually
Kim F. Storm <storm@cua.dk>
parents:
60891
diff
changeset
|
800 bufsize = CALLPROC_BUFFER_SIZE_MAX; |
11619
ff4be652af46
(Fcall_process): Extend BUFFER arg so it can specify
Richard M. Stallman <rms@gnu.org>
parents:
11513
diff
changeset
|
801 |
57473
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
802 if (display_p) |
5251
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
803 { |
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
804 if (first) |
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
805 prepare_menu_bars (); |
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
806 first = 0; |
35336
002c02db42d3
Call redisplay_preserve_echo_area with additional arg.
Gerd Moellmann <gerd@gnu.org>
parents:
33285
diff
changeset
|
807 redisplay_preserve_echo_area (1); |
57473
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
808 /* This variable might have been set to 0 for code |
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
809 detection. In that case, we set it back to 1 because |
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
810 we should have already detected a coding system. */ |
fb60234070b0
(Fcall_process): Simplify handling of display arg.
Kim F. Storm <storm@cua.dk>
parents:
57290
diff
changeset
|
811 display_on_the_fly = 1; |
5251
480731ff8e9a
(Fcall_process): Call prepare_menu_bars.
Richard M. Stallman <rms@gnu.org>
parents:
5179
diff
changeset
|
812 } |
296 | 813 immediate_quit = 1; |
814 QUIT; | |
815 } | |
11780
6ae23eecab6a
(Fcall_process): Keep reading till buffer is nearly full.
Richard M. Stallman <rms@gnu.org>
parents:
11619
diff
changeset
|
816 give_up: ; |
296 | 817 |
88356
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
818 Vlast_coding_system_used = CODING_ID_NAME (process_coding.id); |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
819 /* If the caller required, let the buffer inherit the |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
820 coding-system used to decode the process output. */ |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
821 if (inherit_process_coding_system) |
5ace79aaf5ad
Include "character.h" instead of "charset.h".
Kenichi Handa <handa@m17n.org>
parents:
41861
diff
changeset
|
822 call1 (intern ("after-insert-file-set-buffer-file-coding-system"), |
103111
138b39938198
(Fcall_process): Fix GC protection. Make sure
Andreas Schwab <schwab@linux-m68k.org>
parents:
102360
diff
changeset
|
823 make_number (total_read)); |
21572 | 824 } |
825 | |
296 | 826 /* Wait for it to terminate, unless it already has. */ |
827 wait_for_termination (pid); | |
828 | |
829 immediate_quit = 0; | |
830 | |
6275
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
831 /* 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
|
832 when exiting. */ |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
833 call_process_exited = 1; |
132464faeaf4
Don't kill remaining processes if child exits.
Richard M. Stallman <rms@gnu.org>
parents:
6031
diff
changeset
|
834 |
296 | 835 unbind_to (count, Qnil); |
836 | |
53712
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
837 if (synch_process_termsig) |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
838 { |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
839 char *signame; |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
840 |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
841 synchronize_system_messages_locale (); |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
842 signame = strsignal (synch_process_termsig); |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
843 |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
844 if (signame == 0) |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
845 signame = "unknown"; |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
846 |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
847 synch_process_death = signame; |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
848 } |
659b9b404c02
Define synch_process_termsig.
Jan Djärv <jan.h.d@swipnet.se>
parents:
52401
diff
changeset
|
849 |
296 | 850 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
|
851 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
|
852 Vlocale_coding_system, 0); |
296 | 853 return make_number (synch_process_retcode); |
854 } | |
855 | |
1912
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
856 static Lisp_Object |
296 | 857 delete_temp_file (name) |
858 Lisp_Object name; | |
859 { | |
67989
d7475f0d0bda
(delete_temp_file): Bind file-name-handler-alist to nil for the call
Ken Raeburn <raeburn@raeburn.org>
parents:
67967
diff
changeset
|
860 /* Suppress jka-compr handling, etc. */ |
d7475f0d0bda
(delete_temp_file): Bind file-name-handler-alist to nil for the call
Ken Raeburn <raeburn@raeburn.org>
parents:
67967
diff
changeset
|
861 int count = SPECPDL_INDEX (); |
d7475f0d0bda
(delete_temp_file): Bind file-name-handler-alist to nil for the call
Ken Raeburn <raeburn@raeburn.org>
parents:
67967
diff
changeset
|
862 specbind (intern ("file-name-handler-alist"), Qnil); |
10083
2d7a561cc92c
(delete_temp_file): Use internal_delete_file.
Richard M. Stallman <rms@gnu.org>
parents:
9786
diff
changeset
|
863 internal_delete_file (name); |
67989
d7475f0d0bda
(delete_temp_file): Bind file-name-handler-alist to nil for the call
Ken Raeburn <raeburn@raeburn.org>
parents:
67967
diff
changeset
|
864 unbind_to (count, Qnil); |
29905
ca781f54ac48
(setpgrp): Undefine before defining.
Dave Love <fx@gnu.org>
parents:
29287
diff
changeset
|
865 return Qnil; |
296 | 866 } |
867 | |
868 DEFUN ("call-process-region", Fcall_process_region, Scall_process_region, | |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
869 3, MANY, 0, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
870 doc: /* Send text from START to END to a synchronous process running PROGRAM. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
871 The remaining arguments are optional. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
872 Delete the text if fourth arg DELETE is non-nil. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
873 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
874 Insert output in BUFFER before point; t means current buffer; |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
875 nil for BUFFER means discard it; 0 means discard and don't wait. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
876 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
877 REAL-BUFFER says what to do with standard output, as above, |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
878 while STDERR-FILE says what to do with standard error in the child. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
879 STDERR-FILE may be nil (discard standard error output), |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
880 t (mix it with ordinary output), or a file name string. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
881 |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
882 Sixth arg DISPLAY non-nil means redisplay buffer as output is inserted. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
883 Remaining args are passed to PROGRAM at startup as command args. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
884 |
51070
54c727f3404e
(Fcall_process_region): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
49600
diff
changeset
|
885 If BUFFER is 0, `call-process-region' returns immediately with value nil. |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
886 Otherwise it waits for PROGRAM to terminate |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
887 and returns a numeric exit status or a signal description string. |
40114
c8af574bcf48
(Fcall_process_region, Fcall_process): Add usage: string to doc string.
Miles Bader <miles@gnu.org>
parents:
40103
diff
changeset
|
888 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again. |
c8af574bcf48
(Fcall_process_region, Fcall_process): Add usage: string to doc string.
Miles Bader <miles@gnu.org>
parents:
40103
diff
changeset
|
889 |
c8af574bcf48
(Fcall_process_region, Fcall_process): Add usage: string to doc string.
Miles Bader <miles@gnu.org>
parents:
40103
diff
changeset
|
890 usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS) */) |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
891 (nargs, args) |
296 | 892 int nargs; |
893 register Lisp_Object *args; | |
894 { | |
8555
f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents:
7900
diff
changeset
|
895 struct gcpro gcpro1; |
f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents:
7900
diff
changeset
|
896 Lisp_Object filename_string; |
f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents:
7900
diff
changeset
|
897 register Lisp_Object start, end; |
46293
1fb8f75062c6
Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
46260
diff
changeset
|
898 int count = SPECPDL_INDEX (); |
18539
8c13c54d52c8
Call Ffind_operation_coding_system.
Kenichi Handa <handa@m17n.org>
parents:
18494
diff
changeset
|
899 /* 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
|
900 Lisp_Object coding_systems; |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
901 Lisp_Object val, *args2; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
902 int i; |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
903 char *tempfile; |
101664
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
904 Lisp_Object tmpdir, pattern; |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
905 |
101664
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
906 if (STRINGP (Vtemporary_file_directory)) |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
907 tmpdir = Vtemporary_file_directory; |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
908 else |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
909 { |
101664
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
910 #ifndef DOS_NT |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
911 if (getenv ("TMPDIR")) |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
912 tmpdir = build_string (getenv ("TMPDIR")); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
913 else |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
914 tmpdir = build_string ("/tmp/"); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
915 #else /* DOS_NT */ |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
916 char *outf; |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
917 if ((outf = egetenv ("TMPDIR")) |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
918 || (outf = egetenv ("TMP")) |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
919 || (outf = egetenv ("TEMP"))) |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
920 tmpdir = build_string (outf); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
921 else |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
922 tmpdir = Ffile_name_as_directory (build_string ("c:/temp")); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
923 #endif |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
924 } |
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
925 |
101664
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
926 pattern = Fexpand_file_name (Vtemp_file_name_pattern, tmpdir); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
927 tempfile = (char *) alloca (SBYTES (pattern) + 1); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
928 bcopy (SDATA (pattern), tempfile, SBYTES (pattern) + 1); |
24931
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
929 coding_systems = Qt; |
6ccce3af0d2a
(Fcall_process): Decide coding system for decoding
Richard M. Stallman <rms@gnu.org>
parents:
24920
diff
changeset
|
930 |
33285
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
931 #ifdef HAVE_MKSTEMP |
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
932 { |
75152
69fafc0d9959
(Fcall_process_region) [HAVE_MKSTEMP]: Add BLOCK_INPUT
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
74836
diff
changeset
|
933 int fd; |
69fafc0d9959
(Fcall_process_region) [HAVE_MKSTEMP]: Add BLOCK_INPUT
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
74836
diff
changeset
|
934 |
69fafc0d9959
(Fcall_process_region) [HAVE_MKSTEMP]: Add BLOCK_INPUT
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
74836
diff
changeset
|
935 BLOCK_INPUT; |
69fafc0d9959
(Fcall_process_region) [HAVE_MKSTEMP]: Add BLOCK_INPUT
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
74836
diff
changeset
|
936 fd = mkstemp (tempfile); |
69fafc0d9959
(Fcall_process_region) [HAVE_MKSTEMP]: Add BLOCK_INPUT
YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
parents:
74836
diff
changeset
|
937 UNBLOCK_INPUT; |
33285
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
938 if (fd == -1) |
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
939 report_file_error ("Failed to open temporary file", |
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
940 Fcons (Vtemp_file_name_pattern, Qnil)); |
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
941 else |
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
942 close (fd); |
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
943 } |
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
944 #else |
296 | 945 mktemp (tempfile); |
33285
91819a44456a
(Fcall_process_region): Use HAVE_MKSTEMP.
Dave Love <fx@gnu.org>
parents:
31100
diff
changeset
|
946 #endif |
296 | 947 |
948 filename_string = build_string (tempfile); | |
8555
f1b1537ed3f6
(Fcall_process_region): gcpro filename_string.
Karl Heuer <kwzh@gnu.org>
parents:
7900
diff
changeset
|
949 GCPRO1 (filename_string); |
296 | 950 start = args[0]; |
951 end = args[1]; | |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
952 /* 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
|
953 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
|
954 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
|
955 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
|
956 val = Qnil; |
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
957 else |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
958 { |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
959 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
|
960 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
|
961 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
|
962 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
|
963 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
|
964 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
|
965 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
|
966 val = XCDR (Vdefault_process_coding_system); |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
967 else |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
968 val = Qnil; |
18651
982814f78d0d
(Fcall_process): If enable-multibyte-characters is
Kenichi Handa <handa@m17n.org>
parents:
18539
diff
changeset
|
969 } |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
970 |
21626
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
971 { |
46293
1fb8f75062c6
Use macro SPECPDL_INDEX.
Juanma Barranquero <lekktu@gmail.com>
parents:
46260
diff
changeset
|
972 int count1 = SPECPDL_INDEX (); |
21626
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
973 |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
974 specbind (intern ("coding-system-for-write"), val); |
67967
5936baa93f63
(Fcall_process_region): Bind file-name-handler-alist to nil for the call to
Ken Raeburn <raeburn@raeburn.org>
parents:
64770
diff
changeset
|
975 /* POSIX lets mk[s]temp use "."; don't invoke jka-compr if we |
5936baa93f63
(Fcall_process_region): Bind file-name-handler-alist to nil for the call to
Ken Raeburn <raeburn@raeburn.org>
parents:
64770
diff
changeset
|
976 happen to get a ".Z" suffix. */ |
5936baa93f63
(Fcall_process_region): Bind file-name-handler-alist to nil for the call to
Ken Raeburn <raeburn@raeburn.org>
parents:
64770
diff
changeset
|
977 specbind (intern ("file-name-handler-alist"), Qnil); |
21626
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
978 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
|
979 |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
980 unbind_to (count1, Qnil); |
ad899130056e
(Fcall_process_region): Unbind coding-system-for-write
Richard M. Stallman <rms@gnu.org>
parents:
21572
diff
changeset
|
981 } |
17025
3c222a7edda1
Include charset.h and coding.h.
Karl Heuer <kwzh@gnu.org>
parents:
16659
diff
changeset
|
982 |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
983 /* Note that Fcall_process takes care of binding |
19730
1657f4dd8c05
(Fcall_process): Set EOL conversion type to LF when
Richard M. Stallman <rms@gnu.org>
parents:
19580
diff
changeset
|
984 coding-system-for-read. */ |
7397
e0ffa47f2ed4
[MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents:
7161
diff
changeset
|
985 |
296 | 986 record_unwind_protect (delete_temp_file, filename_string); |
987 | |
23885 | 988 if (nargs > 3 && !NILP (args[3])) |
296 | 989 Fdelete_region (start, end); |
990 | |
23885 | 991 if (nargs > 3) |
992 { | |
993 args += 2; | |
994 nargs -= 2; | |
995 } | |
996 else | |
997 { | |
998 args[0] = args[2]; | |
999 nargs = 2; | |
1000 } | |
1001 args[1] = filename_string; | |
296 | 1002 |
23885 | 1003 RETURN_UNGCPRO (unbind_to (count, Fcall_process (nargs, args))); |
296 | 1004 } |
1005 | |
21514 | 1006 static int relocate_fd (); |
1007 | |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1008 static char ** |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1009 add_env (char **env, char **new_env, char *string) |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1010 { |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1011 char **ep; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1012 int ok = 1; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1013 if (string == NULL) |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1014 return new_env; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1015 |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1016 /* See if this string duplicates any string already in the env. |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1017 If so, don't put it in. |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1018 When an env var has multiple definitions, |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1019 we keep the definition that comes first in process-environment. */ |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1020 for (ep = env; ok && ep != new_env; ep++) |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1021 { |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1022 char *p = *ep, *q = string; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1023 while (ok) |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1024 { |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1025 if (*q != *p) |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1026 break; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1027 if (*q == 0) |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1028 /* The string is a lone variable name; keep it for now, we |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1029 will remove it later. It is a placeholder for a |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1030 variable that is not to be included in the environment. */ |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1031 break; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1032 if (*q == '=') |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1033 ok = 0; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1034 p++, q++; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1035 } |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1036 } |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1037 if (ok) |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1038 *new_env++ = string; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1039 return new_env; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1040 } |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1041 |
296 | 1042 /* This is the last thing run in a newly forked inferior |
1043 either synchronous or asynchronous. | |
1044 Copy descriptors IN, OUT and ERR as descriptors 0, 1 and 2. | |
1045 Initialize inferior's priority, pgrp, connected dir and environment. | |
1046 then exec another program based on new_argv. | |
1047 | |
1048 This function may change environ for the superior process. | |
1049 Therefore, the superior process must save and restore the value | |
1050 of environ around the vfork and the call to this function. | |
1051 | |
1052 SET_PGRP is nonzero if we should put the subprocess into a separate | |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
1053 process group. |
296 | 1054 |
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
|
1055 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
|
1056 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
|
1057 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
|
1058 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
|
1059 |
21514 | 1060 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
|
1061 child_setup (in, out, err, new_argv, set_pgrp, current_dir) |
296 | 1062 int in, out, err; |
1063 register char **new_argv; | |
1064 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
|
1065 Lisp_Object current_dir; |
296 | 1066 { |
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
|
1067 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
|
1068 char *pwd_var; |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1069 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1070 int cpid; |
15087
46157341f721
(Fcall_process) [WINDOWSNT]: Remove conditional NT code.
Richard M. Stallman <rms@gnu.org>
parents:
14872
diff
changeset
|
1071 HANDLE handles[3]; |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1072 #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
|
1073 |
5530
7ff479a8e8bf
(child_setup): Don't declare PID `register'; we later take its address.
Roland McGrath <roland@gnu.org>
parents:
5516
diff
changeset
|
1074 int pid = getpid (); |
296 | 1075 |
7481
b7d23c08750c
(child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents:
7465
diff
changeset
|
1076 #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
|
1077 { |
43713
f92c4d87863a
Change defvar_int def and vars to use EMACS_INT instead of just int.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
41861
diff
changeset
|
1078 extern EMACS_INT 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
|
1079 |
7481
b7d23c08750c
(child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents:
7465
diff
changeset
|
1080 if (emacs_priority < 0) |
b7d23c08750c
(child_setup): PRIO_PROCESS renamed to SET_EMACS_PRIORITY.
Richard M. Stallman <rms@gnu.org>
parents:
7465
diff
changeset
|
1081 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
|
1082 } |
7161
67618cd7bdbf
(child_setup): Test PRIO_PROCESS, as in sys_subshell.
Richard M. Stallman <rms@gnu.org>
parents:
7000
diff
changeset
|
1083 #endif |
296 | 1084 |
1085 #ifdef subprocesses | |
1086 /* Close Emacs's descriptors that this process should not have. */ | |
1087 close_process_descs (); | |
1088 #endif | |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1089 /* 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
|
1090 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
|
1091 #ifndef DOS_NT |
5569
b9e2884ca8e6
(child_setup): Call close_load_descs.
Richard M. Stallman <rms@gnu.org>
parents:
5530
diff
changeset
|
1092 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
|
1093 #endif |
296 | 1094 |
1095 /* Note that use of alloca is always safe here. It's obvious for systems | |
1096 that do not have true vfork or that have true (stack) alloca. | |
84490
23e7b73bbc00
Update comment referring to C_ALLOCA.
Glenn Morris <rgm@gnu.org>
parents:
83802
diff
changeset
|
1097 If using vfork and C_ALLOCA (when Emacs used to include |
23e7b73bbc00
Update comment referring to C_ALLOCA.
Glenn Morris <rgm@gnu.org>
parents:
83802
diff
changeset
|
1098 src/alloca.c) it is safe because that changes the superior's |
23e7b73bbc00
Update comment referring to C_ALLOCA.
Glenn Morris <rgm@gnu.org>
parents:
83802
diff
changeset
|
1099 static variables as if the superior had done alloca and will be |
23e7b73bbc00
Update comment referring to C_ALLOCA.
Glenn Morris <rgm@gnu.org>
parents:
83802
diff
changeset
|
1100 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
|
1101 { |
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
|
1102 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
|
1103 register int i; |
296 | 1104 |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1105 i = SBYTES (current_dir); |
30530
861a1460eba6
(child_setup) [MSDOS]: malloc pwd_var instead of
Eli Zaretskii <eliz@gnu.org>
parents:
29905
diff
changeset
|
1106 #ifdef MSDOS |
861a1460eba6
(child_setup) [MSDOS]: malloc pwd_var instead of
Eli Zaretskii <eliz@gnu.org>
parents:
29905
diff
changeset
|
1107 /* 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
|
1108 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
|
1109 on that. */ |
861a1460eba6
(child_setup) [MSDOS]: malloc pwd_var instead of
Eli Zaretskii <eliz@gnu.org>
parents:
29905
diff
changeset
|
1110 pwd_var = (char *) xmalloc (i + 6); |
861a1460eba6
(child_setup) [MSDOS]: malloc pwd_var instead of
Eli Zaretskii <eliz@gnu.org>
parents:
29905
diff
changeset
|
1111 #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
|
1112 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
|
1113 #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
|
1114 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
|
1115 bcopy ("PWD=", pwd_var, 4); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1116 bcopy (SDATA (current_dir), temp, i); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1117 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
|
1118 temp[i] = 0; |
538 | 1119 |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1120 #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
|
1121 /* 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
|
1122 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
|
1123 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
|
1124 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
|
1125 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
|
1126 if (chdir (temp) < 0) |
9609
74985a8972e4
(child_setup): Always use _exit.
Richard M. Stallman <rms@gnu.org>
parents:
9138
diff
changeset
|
1127 _exit (errno); |
103711
531520bb5152
* sysdep.c (sys_suspend): Remove USG_JOBCTRL #ifdef, unused.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103111
diff
changeset
|
1128 #else /* DOS_NT */ |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1129 /* 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
|
1130 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
|
1131 { |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1132 temp += 2; |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1133 i -= 2; |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1134 } |
103711
531520bb5152
* sysdep.c (sys_suspend): Remove USG_JOBCTRL #ifdef, unused.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
103111
diff
changeset
|
1135 #endif /* DOS_NT */ |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1136 |
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
|
1137 /* 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
|
1138 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
|
1139 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
|
1140 } |
296 | 1141 |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1142 /* Set `env' to a vector of the strings in the environment. */ |
296 | 1143 { |
1144 register Lisp_Object tem; | |
1145 register char **new_env; | |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1146 char **p, **q; |
296 | 1147 register int new_length; |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1148 Lisp_Object display = Qnil; |
83640
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1149 |
296 | 1150 new_length = 0; |
1151 | |
1152 for (tem = Vprocess_environment; | |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1153 CONSP (tem) && STRINGP (XCAR (tem)); |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1154 tem = XCDR (tem)) |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1155 { |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1156 if (strncmp (SDATA (XCAR (tem)), "DISPLAY", 7) == 0 |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1157 && (SDATA (XCAR (tem)) [7] == '\0' |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1158 || SDATA (XCAR (tem)) [7] == '=')) |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1159 /* DISPLAY is specified in process-environment. */ |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1160 display = Qt; |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1161 new_length++; |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1162 } |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1163 |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1164 /* If not provided yet, use the frame's DISPLAY. */ |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1165 if (NILP (display)) |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1166 { |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1167 Lisp_Object tmp = Fframe_parameter (selected_frame, Qdisplay); |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1168 if (!STRINGP (tmp) && CONSP (Vinitial_environment)) |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1169 /* If still not found, Look for DISPLAY in Vinitial_environment. */ |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1170 tmp = Fgetenv_internal (build_string ("DISPLAY"), |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1171 Vinitial_environment); |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1172 if (STRINGP (tmp)) |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1173 { |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1174 display = tmp; |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1175 new_length++; |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1176 } |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1177 } |
296 | 1178 |
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
|
1179 /* 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
|
1180 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
|
1181 /* 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
|
1182 but with corrected value. */ |
83529
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1183 if (egetenv ("PWD")) |
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
|
1184 *new_env++ = pwd_var; |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1185 |
83796
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
1186 if (STRINGP (display)) |
83640
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1187 { |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1188 int vlen = strlen ("DISPLAY=") + strlen (SDATA (display)) + 1; |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1189 char *vdata = (char *) alloca (vlen); |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1190 strcpy (vdata, "DISPLAY="); |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1191 strcat (vdata, SDATA (display)); |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1192 new_env = add_env (env, new_env, vdata); |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1193 } |
296 | 1194 |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1195 /* Overrides. */ |
296 | 1196 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
|
1197 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
|
1198 tem = XCDR (tem)) |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1199 new_env = add_env (env, new_env, SDATA (XCAR (tem))); |
296 | 1200 |
1201 *new_env = 0; | |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1202 |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1203 /* Remove variable names without values. */ |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1204 p = q = env; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1205 while (*p != 0) |
2757
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1206 { |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1207 while (*q != 0 && strchr (*q, '=') == NULL) |
85596
ca34d3d5d8bf
(child_setup): Remove spurious *.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
85146
diff
changeset
|
1208 q++; |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1209 *p = *q++; |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1210 if (*p != 0) |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1211 p++; |
2757
a3ee51f30431
(child_setup): Omit duplicates from new env array.
Richard M. Stallman <rms@gnu.org>
parents:
2509
diff
changeset
|
1212 } |
296 | 1213 } |
83640
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1214 |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1215 |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1216 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1217 prepare_standard_handles (in, out, err, handles); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1218 set_process_dir (SDATA (current_dir)); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1219 #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
|
1220 /* 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
|
1221 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
|
1222 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
|
1223 happen under X. */ |
12430
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1224 { |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1225 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
|
1226 |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1227 /* 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
|
1228 |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1229 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
|
1230 |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1231 if (out == oin) |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1232 out = in; |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1233 else |
6614
e095c5efe2e0
(child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents:
6495
diff
changeset
|
1234 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
|
1235 |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1236 if (err == oin) |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1237 err = in; |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1238 else if (err == oout) |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1239 err = out; |
14792ea851f9
(child_setup): Don't get confused if in == err.
Richard M. Stallman <rms@gnu.org>
parents:
12238
diff
changeset
|
1240 else |
6614
e095c5efe2e0
(child_setup): Check out==err when relocating fds.
Karl Heuer <kwzh@gnu.org>
parents:
6495
diff
changeset
|
1241 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
|
1242 } |
2286
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1243 |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1244 #ifndef MSDOS |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1245 emacs_close (0); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1246 emacs_close (1); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1247 emacs_close (2); |
296 | 1248 |
1249 dup2 (in, 0); | |
1250 dup2 (out, 1); | |
1251 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
|
1252 emacs_close (in); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1253 emacs_close (out); |
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1254 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
|
1255 #endif /* not MSDOS */ |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1256 #endif /* not WINDOWSNT */ |
296 | 1257 |
14872
c001b28bf068
(Fcall_process, child_setup): If BSD_PGRPS, call
Richard M. Stallman <rms@gnu.org>
parents:
14438
diff
changeset
|
1258 #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
|
1259 #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
|
1260 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
|
1261 #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
|
1262 #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
|
1263 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
|
1264 #endif /* USG */ |
5348 | 1265 /* setpgrp_of_tty is incorrect here; it uses input_fd. */ |
1266 EMACS_SET_TTY_PGRP (0, &pid); | |
296 | 1267 |
21694
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1268 #ifdef MSDOS |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1269 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
|
1270 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
|
1271 if (pid == -1) |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1272 /* 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
|
1273 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
|
1274 return pid; |
6e12eeda6913
(Fcall_process) [MSDOS]: Call child_setup instead of run_msdos_command.
Eli Zaretskii <eliz@gnu.org>
parents:
21626
diff
changeset
|
1275 #else /* not MSDOS */ |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1276 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1277 /* 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
|
1278 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
|
1279 reset_standard_handles (in, out, err, handles); |
11379
23f7aa711f96
(child_setup) [WINDOWSNT]: Removed syntax errors.
Karl Heuer <kwzh@gnu.org>
parents:
11235
diff
changeset
|
1280 if (cpid == -1) |
23f7aa711f96
(child_setup) [WINDOWSNT]: Removed syntax errors.
Karl Heuer <kwzh@gnu.org>
parents:
11235
diff
changeset
|
1281 /* 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
|
1282 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
|
1283 return cpid; |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1284 #else /* not WINDOWSNT */ |
296 | 1285 /* execvp does not accept an environment arg so the only way |
1286 to pass this environment is to set environ. Our caller | |
1287 is responsible for restoring the ambient value of environ. */ | |
1288 environ = env; | |
1289 execvp (new_argv[0], new_argv); | |
1290 | |
26088
b7aa6ac26872
Add support for large files, 64-bit Solaris, system locale codings.
Paul Eggert <eggert@twinsun.com>
parents:
25767
diff
changeset
|
1291 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
|
1292 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
|
1293 emacs_write (1, "\n", 1); |
296 | 1294 _exit (1); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1295 #endif /* not WINDOWSNT */ |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
1296 #endif /* not MSDOS */ |
296 | 1297 } |
1298 | |
21454
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1299 /* 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
|
1300 If the file descriptor is moved at all, the original is freed. */ |
21514 | 1301 static int |
21454
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1302 relocate_fd (fd, minfd) |
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1303 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
|
1304 { |
21454
1361a790bca8
(relocate_fd): Avoid `min'/`max' as variable names.
Karl Heuer <kwzh@gnu.org>
parents:
21244
diff
changeset
|
1305 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
|
1306 return fd; |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1307 else |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1308 { |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1309 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
|
1310 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
|
1311 { |
2509
daaa78c8c980
* callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents:
2432
diff
changeset
|
1312 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
|
1313 char *errmessage = strerror (errno); |
2509
daaa78c8c980
* callproc.c (relocate_fd): Make messages string literals, not
Jim Blandy <jimb@redhat.com>
parents:
2432
diff
changeset
|
1314 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
|
1315 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
|
1316 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
|
1317 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
|
1318 _exit (1); |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1319 } |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1320 /* 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
|
1321 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
|
1322 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
|
1323 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
|
1324 return new; |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1325 } |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1326 } |
7f66b40a0192
* callproc.c (child_setup): Make sure that in, out, and err are
Jim Blandy <jimb@redhat.com>
parents:
1912
diff
changeset
|
1327 |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1328 static int |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1329 getenv_internal_1 (var, varlen, value, valuelen, env) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1330 char *var; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1331 int varlen; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1332 char **value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1333 int *valuelen; |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1334 Lisp_Object env; |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1335 { |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1336 for (; CONSP (env); env = XCDR (env)) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1337 { |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1338 Lisp_Object entry = XCAR (env); |
9138
6c814eb4d892
(Fcall_process, child_setup, getenv_internal): Use type test macros.
Karl Heuer <kwzh@gnu.org>
parents:
8853
diff
changeset
|
1339 if (STRINGP (entry) |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1340 && SBYTES (entry) >= varlen |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1341 #ifdef WINDOWSNT |
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1342 /* NT environment variables are case insensitive. */ |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1343 && ! strnicmp (SDATA (entry), var, varlen) |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1344 #else /* not WINDOWSNT */ |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1345 && ! bcmp (SDATA (entry), var, varlen) |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1346 #endif /* not WINDOWSNT */ |
11393
81653012e0a6
(getenv_internal): Balance parentheses across #if/#endif.
Karl Heuer <kwzh@gnu.org>
parents:
11379
diff
changeset
|
1347 ) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1348 { |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1349 if (SBYTES (entry) > varlen && SREF (entry, varlen) == '=') |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1350 { |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1351 *value = (char *) SDATA (entry) + (varlen + 1); |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1352 *valuelen = SBYTES (entry) - (varlen + 1); |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1353 return 1; |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1354 } |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1355 else if (SBYTES (entry) == varlen) |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1356 { |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1357 /* Lone variable names in Vprocess_environment mean that |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1358 variable should be removed from the environment. */ |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1359 *value = NULL; |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1360 return 1; |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1361 } |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1362 } |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1363 } |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1364 return 0; |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1365 } |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1366 |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1367 static int |
83427
2afc49c9f0c0
Store local environment in frame (not terminal) parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
83426
diff
changeset
|
1368 getenv_internal (var, varlen, value, valuelen, frame) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1369 char *var; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1370 int varlen; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1371 char **value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1372 int *valuelen; |
83427
2afc49c9f0c0
Store local environment in frame (not terminal) parameters.
Karoly Lorentey <lorentey@elte.hu>
parents:
83426
diff
changeset
|
1373 Lisp_Object frame; |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1374 { |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1375 /* Try to find VAR in Vprocess_environment first. */ |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1376 if (getenv_internal_1 (var, varlen, value, valuelen, |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1377 Vprocess_environment)) |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1378 return *value ? 1 : 0; |
83796
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
1379 |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1380 /* For DISPLAY try to get the values from the frame or the initial env. */ |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1381 if (strcmp (var, "DISPLAY") == 0) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1382 { |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1383 Lisp_Object display |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1384 = Fframe_parameter (NILP (frame) ? selected_frame : frame, Qdisplay); |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1385 if (STRINGP (display)) |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1386 { |
83640
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1387 *value = (char *) SDATA (display); |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1388 *valuelen = SBYTES (display); |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1389 return 1; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1390 } |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1391 /* If still not found, Look for DISPLAY in Vinitial_environment. */ |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1392 if (getenv_internal_1 (var, varlen, value, valuelen, |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1393 Vinitial_environment)) |
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1394 return *value ? 1 : 0; |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1395 } |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1396 |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1397 return 0; |
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 |
83421
bb2edc915032
Implement automatic terminal-local environment variables via `local-environment-variables'.
Karoly Lorentey <lorentey@elte.hu>
parents:
64770
diff
changeset
|
1400 DEFUN ("getenv-internal", Fgetenv_internal, Sgetenv_internal, 1, 2, 0, |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1401 doc: /* Get the value of environment variable VARIABLE. |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1402 VARIABLE should be a string. Value is nil if VARIABLE is undefined in |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1403 the environment. Otherwise, value is a string. |
83421
bb2edc915032
Implement automatic terminal-local environment variables via `local-environment-variables'.
Karoly Lorentey <lorentey@elte.hu>
parents:
64770
diff
changeset
|
1404 |
101275
5bc8609f80b5
* callproc.c (Fgetenv_internal): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
100951
diff
changeset
|
1405 This function searches `process-environment' for VARIABLE. |
83421
bb2edc915032
Implement automatic terminal-local environment variables via `local-environment-variables'.
Karoly Lorentey <lorentey@elte.hu>
parents:
64770
diff
changeset
|
1406 |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1407 If optional parameter ENV is a list, then search this list instead of |
101275
5bc8609f80b5
* callproc.c (Fgetenv_internal): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
100951
diff
changeset
|
1408 `process-environment', and return t when encountering a negative entry |
5bc8609f80b5
* callproc.c (Fgetenv_internal): Doc fix.
Juanma Barranquero <lekktu@gmail.com>
parents:
100951
diff
changeset
|
1409 \(an entry for a variable with no value). */) |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1410 (variable, env) |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1411 Lisp_Object variable, env; |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1412 { |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1413 char *value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1414 int valuelen; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1415 |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1416 CHECK_STRING (variable); |
84702
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1417 if (CONSP (env)) |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1418 { |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1419 if (getenv_internal_1 (SDATA (variable), SBYTES (variable), |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1420 &value, &valuelen, env)) |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1421 return value ? make_string (value, valuelen) : Qt; |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1422 else |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1423 return Qnil; |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1424 } |
f859ca19dbb0
(getenv_internal_1): New function.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84490
diff
changeset
|
1425 else if (getenv_internal (SDATA (variable), SBYTES (variable), |
84740
275cddd2a0da
(child_setup, getenv_internal): Use the frame's `display'
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
84702
diff
changeset
|
1426 &value, &valuelen, env)) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1427 return make_string (value, valuelen); |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1428 else |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1429 return Qnil; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1430 } |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1431 |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1432 /* A version of getenv that consults the Lisp environment lists, |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1433 easily callable from C. */ |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1434 char * |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1435 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
|
1436 char *var; |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1437 { |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1438 char *value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1439 int valuelen; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1440 |
83421
bb2edc915032
Implement automatic terminal-local environment variables via `local-environment-variables'.
Karoly Lorentey <lorentey@elte.hu>
parents:
64770
diff
changeset
|
1441 if (getenv_internal (var, strlen (var), &value, &valuelen, Qnil)) |
942
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1442 return value; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1443 else |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1444 return 0; |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1445 } |
c519b70eb50b
Replaced fuctions egetenv, Fgetenv, getenv_internal, which had
Joseph Arceneaux <jla@gnu.org>
parents:
934
diff
changeset
|
1446 |
296 | 1447 |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1448 /* This is run before init_cmdargs. */ |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
1449 |
21514 | 1450 void |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1451 init_callproc_1 () |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1452 { |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1453 char *data_dir = egetenv ("EMACSDATA"); |
6031
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1454 char *doc_dir = egetenv ("EMACSDOC"); |
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1455 |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1456 Vdata_directory |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
1457 = 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
|
1458 : PATH_DATA)); |
6031
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1459 Vdoc_directory |
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1460 = 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
|
1461 : 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
|
1462 |
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
1463 /* 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
|
1464 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
|
1465 Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC); |
296 | 1466 Vexec_directory = Ffile_name_as_directory (Fcar (Vexec_path)); |
1467 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
|
1468 } |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1469 |
12615
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1470 /* 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
|
1471 |
21514 | 1472 void |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1473 init_callproc () |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1474 { |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1475 char *data_dir = egetenv ("EMACSDATA"); |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
1476 |
5154
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1477 register char * sh; |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1478 Lisp_Object tempdir; |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1479 |
22373
cb8484085daf
(init_callproc): Check Vinstallation_directory even if !initialized.
Richard M. Stallman <rms@gnu.org>
parents:
22320
diff
changeset
|
1480 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
|
1481 { |
5618
a70dc7c886d0
(init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents:
5569
diff
changeset
|
1482 /* 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
|
1483 Lisp_Object tem; |
a70dc7c886d0
(init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents:
5569
diff
changeset
|
1484 tem = Fexpand_file_name (build_string ("lib-src"), |
a70dc7c886d0
(init_callproc): Use Vinstallation_directory.
Richard M. Stallman <rms@gnu.org>
parents:
5569
diff
changeset
|
1485 Vinstallation_directory); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1486 #ifndef DOS_NT |
7824
de1dfb8aea82
(init_callproc) [MSDOS]: Exclude less code, so ../etc
Richard M. Stallman <rms@gnu.org>
parents:
7782
diff
changeset
|
1487 /* 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
|
1488 if (NILP (Fmember (tem, Vexec_path))) |
41861
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1489 { |
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1490 Vexec_path = decode_env_path ("EMACSPATH", PATH_EXEC); |
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1491 Vexec_path = Fcons (tem, Vexec_path); |
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1492 Vexec_path = nconc2 (decode_env_path ("PATH", ""), Vexec_path); |
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1493 } |
49600
23a1cea22d13
Trailing whitespace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
47018
diff
changeset
|
1494 |
24920
d95c8bcfe8ae
(init_callproc): Set exec_directory if installation_directory is
Richard M. Stallman <rms@gnu.org>
parents:
24432
diff
changeset
|
1495 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
|
1496 #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
|
1497 |
12615
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1498 /* 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
|
1499 if (data_dir == 0) |
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1500 { |
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1501 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
|
1502 Vinstallation_directory); |
d5db61e1a4ee
(init_callproc): Set Vdoc_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
12430
diff
changeset
|
1503 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
|
1504 } |
e4e66bcaa016
(init_callproc): Maybe add ../lib-src to exec-path
Richard M. Stallman <rms@gnu.org>
parents:
4977
diff
changeset
|
1505 } |
7465
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 /* 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
|
1508 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
|
1509 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
|
1510 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
|
1511 |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1512 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
|
1513 source directory. */ |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1514 if (data_dir == 0) |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1515 { |
41861
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1516 Lisp_Object tem, tem1, srcdir; |
7465
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1517 |
41861
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1518 srcdir = Fexpand_file_name (build_string ("../src/"), |
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1519 build_string (PATH_DUMPLOADSEARCH)); |
7465
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1520 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
|
1521 tem1 = Ffile_exists_p (tem); |
41861
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1522 if (!NILP (Fequal (srcdir, Vinvocation_directory)) || NILP (tem1)) |
7465
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1523 { |
41861
56385cb63c61
(init_callproc): Set Vdata_directory based on the source
Richard M. Stallman <rms@gnu.org>
parents:
41528
diff
changeset
|
1524 Lisp_Object newdir; |
7465
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1525 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
|
1526 build_string (PATH_DUMPLOADSEARCH)); |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1527 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
|
1528 tem1 = Ffile_exists_p (tem); |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1529 if (!NILP (tem1)) |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1530 Vdata_directory = newdir; |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1531 } |
fccf9d4df7bb
(init_callproc): Never set Vdata_directory based on
Richard M. Stallman <rms@gnu.org>
parents:
7397
diff
changeset
|
1532 } |
296 | 1533 |
19498
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1534 #ifndef CANNOT_DUMP |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1535 if (initialized) |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1536 #endif |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1537 { |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1538 tempdir = Fdirectory_file_name (Vexec_directory); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1539 if (access (SDATA (tempdir), 0) < 0) |
19498
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1540 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
|
1541 Vexec_directory); |
34057e215ab1
(init_callproc): Don't warn about missing
Richard M. Stallman <rms@gnu.org>
parents:
19135
diff
changeset
|
1542 } |
296 | 1543 |
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
|
1544 tempdir = Fdirectory_file_name (Vdata_directory); |
46370
40db0673e6f0
Most uses of XSTRING combined with STRING_BYTES or indirection changed to
Ken Raeburn <raeburn@raeburn.org>
parents:
46293
diff
changeset
|
1545 if (access (SDATA (tempdir), 0) < 0) |
16486
30b8c014eaa7
(init_callproc): Use dir_warning.
Richard M. Stallman <rms@gnu.org>
parents:
15824
diff
changeset
|
1546 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
|
1547 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
|
1548 |
928ed74adf4f
Restored up-to-date version of this file from pogo. What is going on
Jim Blandy <jimb@redhat.com>
parents:
942
diff
changeset
|
1549 sh = (char *) getenv ("SHELL"); |
296 | 1550 Vshell_file_name = build_string (sh ? sh : "/bin/sh"); |
16627
530b3f7373db
(Vtemp_file_name_pattern): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
16593
diff
changeset
|
1551 |
46626
4173dcd87832
(init_callproc) [DOS_NT]: Initialize Vshared_game_score_directory to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
46600
diff
changeset
|
1552 #ifdef DOS_NT |
4173dcd87832
(init_callproc) [DOS_NT]: Initialize Vshared_game_score_directory to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
46600
diff
changeset
|
1553 Vshared_game_score_directory = Qnil; |
4173dcd87832
(init_callproc) [DOS_NT]: Initialize Vshared_game_score_directory to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
46600
diff
changeset
|
1554 #else |
46600
736bbb2f8711
(init_callproc): Set up Vshared_game_score_directory.
Richard M. Stallman <rms@gnu.org>
parents:
46546
diff
changeset
|
1555 Vshared_game_score_directory = build_string (PATH_GAME); |
736bbb2f8711
(init_callproc): Set up Vshared_game_score_directory.
Richard M. Stallman <rms@gnu.org>
parents:
46546
diff
changeset
|
1556 if (NILP (Ffile_directory_p (Vshared_game_score_directory))) |
736bbb2f8711
(init_callproc): Set up Vshared_game_score_directory.
Richard M. Stallman <rms@gnu.org>
parents:
46546
diff
changeset
|
1557 Vshared_game_score_directory = Qnil; |
46626
4173dcd87832
(init_callproc) [DOS_NT]: Initialize Vshared_game_score_directory to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
46600
diff
changeset
|
1558 #endif |
1912
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1559 } |
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1560 |
21514 | 1561 void |
83529
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1562 set_initial_environment () |
1912
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1563 { |
f0d4fb2b9157
* callproc.c (delete_temp_file): Declare this to return
Jim Blandy <jimb@redhat.com>
parents:
1886
diff
changeset
|
1564 register char **envp; |
296 | 1565 #ifndef CANNOT_DUMP |
1566 if (initialized) | |
96675
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
94963
diff
changeset
|
1567 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
94963
diff
changeset
|
1568 #else |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
94963
diff
changeset
|
1569 { |
d45acf0c8d23
merging Emacs.app (NeXTstep port)
Adrian Robert <Adrian.B.Robert@gmail.com>
parents:
94963
diff
changeset
|
1570 Vprocess_environment = Qnil; |
296 | 1571 #endif |
83529
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1572 for (envp = environ; *envp; envp++) |
83640
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1573 Vprocess_environment = Fcons (build_string (*envp), |
2aee92eacdab
* server.el (server-process-filter): Likewise.
Dan Nicolaescu <dann@ics.uci.edu>
parents:
83556
diff
changeset
|
1574 Vprocess_environment); |
83799
6aa4d1effd67
(set_initial_environment): Set Vinitial_environment only when
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83796
diff
changeset
|
1575 /* Ideally, the `copy' shouldn't be necessary, but it seems it's frequent |
6aa4d1effd67
(set_initial_environment): Set Vinitial_environment only when
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83796
diff
changeset
|
1576 to use `delete' and friends on process-environment. */ |
6aa4d1effd67
(set_initial_environment): Set Vinitial_environment only when
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83796
diff
changeset
|
1577 Vinitial_environment = Fcopy_sequence (Vprocess_environment); |
83529
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1578 } |
296 | 1579 } |
1580 | |
21514 | 1581 void |
296 | 1582 syms_of_callproc () |
1583 { | |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1584 #ifdef DOS_NT |
7397
e0ffa47f2ed4
[MSDOS]: Rename Vbinary_process to Vbinary_process_output.
Richard M. Stallman <rms@gnu.org>
parents:
7161
diff
changeset
|
1585 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
|
1586 staticpro (&Qbuffer_file_type); |
9786
7f4b72244919
(getenv_internal) [WINDOWSNT]: Use strnicmp, not bcmp.
Richard M. Stallman <rms@gnu.org>
parents:
9609
diff
changeset
|
1587 #endif /* DOS_NT */ |
5501
902cd7024cfa
(syms_of_callproc) [MSDOS]: New lisp variable: binary-process.
Richard M. Stallman <rms@gnu.org>
parents:
5348
diff
changeset
|
1588 |
101664
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1589 #ifndef DOS_NT |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1590 Vtemp_file_name_pattern = build_string ("emacsXXXXXX"); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1591 #elif defined (WINDOWSNT) |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1592 Vtemp_file_name_pattern = build_string ("emXXXXXX"); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1593 #else |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1594 Vtemp_file_name_pattern = build_string ("detmp.XXX"); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1595 #endif |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1596 staticpro (&Vtemp_file_name_pattern); |
9415ef85934e
(Vtemp_file_name_pattern): Remove DEFVAR_LISP.
Chong Yidong <cyd@stupidchicken.com>
parents:
101275
diff
changeset
|
1597 |
296 | 1598 DEFVAR_LISP ("shell-file-name", &Vshell_file_name, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1599 doc: /* *File name to load inferior shells from. |
74836 | 1600 Initialized from the SHELL environment variable, or to a system-dependent |
1601 default if SHELL is not set. */); | |
296 | 1602 |
1603 DEFVAR_LISP ("exec-path", &Vexec_path, | |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1604 doc: /* *List of directories to search programs to run in subprocesses. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1605 Each element is a string (directory name) or nil (try default directory). */); |
296 | 1606 |
39811
9f7e72fba3d2
(Vexec_suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39535
diff
changeset
|
1607 DEFVAR_LISP ("exec-suffixes", &Vexec_suffixes, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1608 doc: /* *List of suffixes to try to find executable file names. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1609 Each element is a string. */); |
39934
674e73ec881a
(syms_of_callproc): Init Vexec_suffixes to Qnil.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39811
diff
changeset
|
1610 Vexec_suffixes = Qnil; |
39811
9f7e72fba3d2
(Vexec_suffixes): New var.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
39535
diff
changeset
|
1611 |
296 | 1612 DEFVAR_LISP ("exec-directory", &Vexec_directory, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1613 doc: /* Directory for executables for Emacs to invoke. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1614 More generally, this includes any architecture-dependent files |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1615 that are built and installed from the Emacs distribution. */); |
439 | 1616 |
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
|
1617 DEFVAR_LISP ("data-directory", &Vdata_directory, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1618 doc: /* Directory of machine-independent files that come with GNU Emacs. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1619 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
|
1620 |
6031
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1621 DEFVAR_LISP ("doc-directory", &Vdoc_directory, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1622 doc: /* Directory containing the DOC file that comes with GNU Emacs. |
75969
58d48cd0f5f0
(syms_of_callproc) <doc-directory, configure-info-directory>:
Juanma Barranquero <lekktu@gmail.com>
parents:
75348
diff
changeset
|
1623 This is usually the same as `data-directory'. */); |
6031
ae4c6623837b
(syms_of_callproc): New variable Vdoc_directory.
Karl Heuer <kwzh@gnu.org>
parents:
5688
diff
changeset
|
1624 |
3064
fa5466904709
* paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
1625 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory, |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1626 doc: /* For internal use by the build procedure only. |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1627 This is the name of the directory in which the build procedure installed |
75969
58d48cd0f5f0
(syms_of_callproc) <doc-directory, configure-info-directory>:
Juanma Barranquero <lekktu@gmail.com>
parents:
75348
diff
changeset
|
1628 Emacs's info files; the default value for `Info-default-directory-list' |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1629 includes this. */); |
3064
fa5466904709
* paths.h (PATH_INFO): New path, to edited by the configuration
Jim Blandy <jimb@redhat.com>
parents:
2961
diff
changeset
|
1630 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
|
1631 |
45092
7f1d09693ef3
(Vgame_score_directory): Renamed to Vshared_game_score_directory.
Colin Walters <walters@gnu.org>
parents:
45002
diff
changeset
|
1632 DEFVAR_LISP ("shared-game-score-directory", &Vshared_game_score_directory, |
44486
7b98c268f335
(Vgame_score_directory): New variable.
Colin Walters <walters@gnu.org>
parents:
43713
diff
changeset
|
1633 doc: /* Directory of score files for games which come with GNU Emacs. |
7b98c268f335
(Vgame_score_directory): New variable.
Colin Walters <walters@gnu.org>
parents:
43713
diff
changeset
|
1634 If this variable is nil, then Emacs is unable to use a shared directory. */); |
46626
4173dcd87832
(init_callproc) [DOS_NT]: Initialize Vshared_game_score_directory to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
46600
diff
changeset
|
1635 #ifdef DOS_NT |
4173dcd87832
(init_callproc) [DOS_NT]: Initialize Vshared_game_score_directory to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
46600
diff
changeset
|
1636 Vshared_game_score_directory = Qnil; |
4173dcd87832
(init_callproc) [DOS_NT]: Initialize Vshared_game_score_directory to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
46600
diff
changeset
|
1637 #else |
46600
736bbb2f8711
(init_callproc): Set up Vshared_game_score_directory.
Richard M. Stallman <rms@gnu.org>
parents:
46546
diff
changeset
|
1638 Vshared_game_score_directory = build_string (PATH_GAME); |
46626
4173dcd87832
(init_callproc) [DOS_NT]: Initialize Vshared_game_score_directory to nil.
Juanma Barranquero <lekktu@gmail.com>
parents:
46600
diff
changeset
|
1639 #endif |
44486
7b98c268f335
(Vgame_score_directory): New variable.
Colin Walters <walters@gnu.org>
parents:
43713
diff
changeset
|
1640 |
83796
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
1641 DEFVAR_LISP ("initial-environment", &Vinitial_environment, |
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
1642 doc: /* List of environment variables inherited from the parent process. |
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
1643 Each element should be a string of the form ENVVARNAME=VALUE. |
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
1644 The elements must normally be decoded (using `locale-coding-system') for use. */); |
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
1645 Vinitial_environment = Qnil; |
e7303426ed25
(Vinitial_environment): New variable.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
83652
diff
changeset
|
1646 |
296 | 1647 DEFVAR_LISP ("process-environment", &Vprocess_environment, |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1648 doc: /* List of overridden environment variables for subprocesses to inherit. |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1649 Each element should be a string of the form ENVVARNAME=VALUE. |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1650 |
83529
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1651 Entries in this list take precedence to those in the frame-local |
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1652 environments. Therefore, let-binding `process-environment' is an easy |
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1653 way to temporarily change the value of an environment variable, |
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1654 irrespective of where it comes from. To use `process-environment' to |
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1655 remove an environment variable, include only its name in the list, |
0d9e16eab053
Rework environment variable support. (Reported by Kalle Olavi Niemitalo and Noah Friedman.)
Karoly Lorentey <lorentey@elte.hu>
parents:
83518
diff
changeset
|
1656 without "=VALUE". |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1657 |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1658 This variable is set to nil when Emacs starts. |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1659 |
40103
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1660 If multiple entries define the same variable, the first one always |
6b389fb978bc
Change doc-string comments to `new style' [w/`doc:' keyword].
Pavel Janík <Pavel@Janik.cz>
parents:
39934
diff
changeset
|
1661 takes precedence. |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1662 |
51403 | 1663 Non-ASCII characters are encoded according to the initial value of |
83425
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1664 `locale-coding-system', i.e. the elements must normally be decoded for |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1665 use. |
c82829d08b89
Fix semantics of let-binding `process-environment'.
Karoly Lorentey <lorentey@elte.hu>
parents:
83422
diff
changeset
|
1666 |
51403 | 1667 See `setenv' and `getenv'. */); |
83426
7c7d1f1cb2e7
Initialize Vprocess_environment to nil.
Karoly Lorentey <lorentey@elte.hu>
parents:
83425
diff
changeset
|
1668 Vprocess_environment = Qnil; |
296 | 1669 |
1670 defsubr (&Scall_process); | |
28914
45b919961573
(Fgetenv_internal): Renamed from Fgetenv.
Gerd Moellmann <gerd@gnu.org>
parents:
26838
diff
changeset
|
1671 defsubr (&Sgetenv_internal); |
296 | 1672 defsubr (&Scall_process_region); |
1673 } | |
52401 | 1674 |
1675 /* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95 | |
1676 (do not change this comment) */ |