0
|
1 /* Synchronous subprocess invocation for XEmacs.
|
|
2 Copyright (C) 1985, 86, 87, 88, 93, 94, 95 Free Software Foundation, Inc.
|
|
3
|
|
4 This file is part of XEmacs.
|
|
5
|
|
6 XEmacs is free software; you can redistribute it and/or modify it
|
|
7 under the terms of the GNU General Public License as published by the
|
|
8 Free Software Foundation; either version 2, or (at your option) any
|
|
9 later version.
|
|
10
|
|
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
|
|
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
14 for more details.
|
|
15
|
|
16 You should have received a copy of the GNU General Public License
|
|
17 along with XEmacs; see the file COPYING. If not, write to
|
|
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
19 Boston, MA 02111-1307, USA. */
|
|
20
|
|
21 /* Synched up with: Mule 2.0, FSF 19.30. */
|
|
22
|
|
23 #include <config.h>
|
|
24 #include "lisp.h"
|
|
25
|
|
26 #include "buffer.h"
|
|
27 #include "commands.h"
|
|
28 #include "insdel.h"
|
|
29 #include "lstream.h"
|
|
30 #include "paths.h"
|
|
31 #include "process.h"
|
|
32 #include "sysdep.h"
|
|
33 #include "window.h"
|
70
|
34 #ifdef MULE
|
|
35 #include "mule-coding.h"
|
|
36 #endif
|
0
|
37
|
|
38 #include "systime.h"
|
|
39 #include "sysproc.h"
|
100
|
40 #include "sysfile.h" /* Always include after sysproc.h */
|
0
|
41 #include "syssignal.h" /* Always include before systty.h */
|
|
42 #include "systty.h"
|
|
43
|
100
|
44 #ifdef WINDOWSNT
|
|
45 #define _P_NOWAIT 1 /* from process.h */
|
|
46 #endif
|
0
|
47
|
|
48 #ifdef DOS_NT
|
|
49 /* When we are starting external processes we need to know whether they
|
|
50 take binary input (no conversion) or text input (\n is converted to
|
|
51 \r\n). Similar for output: if newlines are written as \r\n then it's
|
|
52 text process output, otherwise it's binary. */
|
|
53 Lisp_Object Vbinary_process_input;
|
|
54 Lisp_Object Vbinary_process_output;
|
|
55 #endif /* DOS_NT */
|
|
56
|
|
57 Lisp_Object Vexec_path, Vexec_directory, Vdata_directory, Vdoc_directory;
|
110
|
58 Lisp_Object Vconfigure_info_directory, Vsite_directory;
|
0
|
59
|
|
60 /* The default base directory XEmacs is installed under. */
|
|
61 Lisp_Object Vprefix_directory;
|
|
62
|
|
63 Lisp_Object Vshell_file_name;
|
|
64
|
|
65 /* The environment to pass to all subprocesses when they are started.
|
|
66 This is in the semi-bogus format of ("VAR=VAL" "VAR2=VAL2" ... )
|
|
67 */
|
|
68 Lisp_Object Vprocess_environment;
|
|
69
|
|
70 /* True iff we are about to fork off a synchronous process or if we
|
|
71 are waiting for it. */
|
|
72 volatile int synch_process_alive;
|
|
73
|
|
74 /* Nonzero => this is a string explaining death of synchronous subprocess. */
|
|
75 CONST char *synch_process_death;
|
|
76
|
|
77 /* If synch_process_death is zero,
|
|
78 this is exit code of synchronous subprocess. */
|
|
79 int synch_process_retcode;
|
|
80
|
|
81 /* Clean up when exiting Fcall_process_internal.
|
|
82 On MSDOS, delete the temporary file on any kind of termination.
|
|
83 On Unix, kill the process and any children on termination by signal. */
|
|
84
|
|
85 /* Nonzero if this is termination due to exit. */
|
|
86 static int call_process_exited;
|
|
87
|
|
88 #ifndef VMS /* VMS version is in vmsproc.c. */
|
|
89
|
|
90 static Lisp_Object
|
|
91 call_process_kill (Lisp_Object fdpid)
|
|
92 {
|
|
93 Lisp_Object fd = Fcar (fdpid);
|
|
94 Lisp_Object pid = Fcdr (fdpid);
|
|
95
|
|
96 if (!NILP (fd))
|
|
97 close (XINT (fd));
|
|
98
|
|
99 if (!NILP (pid))
|
|
100 EMACS_KILLPG (XINT (pid), SIGKILL);
|
|
101
|
|
102 synch_process_alive = 0;
|
|
103 return Qnil;
|
|
104 }
|
|
105
|
|
106 static Lisp_Object
|
|
107 call_process_cleanup (Lisp_Object fdpid)
|
|
108 {
|
|
109 #ifdef MSDOS
|
|
110 /* for MSDOS fdpid is really (fd . tempfile) */
|
|
111 Lisp_Object file = Fcdr (fdpid);
|
|
112 close (XINT (Fcar (fdpid)));
|
14
|
113 if (strcmp (XSTRING_DATA (file), NULL_DEVICE) != 0)
|
|
114 unlink (XSTRING_DATA (file));
|
0
|
115 #else /* not MSDOS */
|
|
116 int fd = XINT (Fcar (fdpid));
|
|
117 int pid = XINT (Fcdr (fdpid));
|
|
118
|
|
119 if (!call_process_exited &&
|
|
120 EMACS_KILLPG (pid, SIGINT) == 0)
|
|
121 {
|
|
122 int speccount = specpdl_depth ();
|
|
123
|
|
124 record_unwind_protect (call_process_kill, fdpid);
|
|
125 /* #### "c-G" -- need non-consing Single-key-description */
|
|
126 message ("Waiting for process to die...(type C-g again to kill it instantly)");
|
|
127
|
|
128 /* "Discard" the unwind protect. */
|
|
129 XCAR (fdpid) = Qnil;
|
|
130 XCDR (fdpid) = Qnil;
|
|
131 unbind_to (speccount, Qnil);
|
|
132
|
|
133 message ("Waiting for process to die... done");
|
|
134 }
|
|
135 synch_process_alive = 0;
|
|
136 close (fd);
|
|
137 #endif /* not MSDOS */
|
|
138 return Qnil;
|
|
139 }
|
|
140
|
|
141 static Lisp_Object fork_error;
|
|
142 #if 0 /* UNUSED */
|
|
143 static void
|
|
144 report_fork_error (char *string, Lisp_Object data)
|
|
145 {
|
|
146 Lisp_Object errstring = build_string (strerror (errno));
|
|
147
|
|
148 /* System error messages are capitalized. Downcase the initial. */
|
|
149 set_string_char (XSTRING (errstring), 0,
|
|
150 DOWNCASE (current_buffer,
|
|
151 string_char (XSTRING (errstring), 0)));
|
|
152
|
|
153 fork_error = Fcons (build_string (string), Fcons (errstring, data));
|
|
154
|
|
155 /* terminate this branch of the fork, without closing stdin/out/etc. */
|
|
156 _exit (1);
|
|
157 }
|
|
158 #endif /* unused */
|
|
159
|
20
|
160 DEFUN ("call-process-internal", Fcall_process_internal, 1, MANY, 0, /*
|
0
|
161 Call PROGRAM synchronously in separate process, with coding-system specified.
|
|
162 Arguments are
|
|
163 (PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS).
|
|
164 The program's input comes from file INFILE (nil means `/dev/null').
|
|
165 Insert output in BUFFER before point; t means current buffer;
|
|
166 nil for BUFFER means discard it; 0 means discard and don't wait.
|
|
167 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
|
|
168 REAL-BUFFER says what to do with standard output, as above,
|
|
169 while STDERR-FILE says what to do with standard error in the child.
|
|
170 STDERR-FILE may be nil (discard standard error output),
|
|
171 t (mix it with ordinary output), or a file name string.
|
|
172
|
|
173 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.
|
|
174 Remaining arguments are strings passed as command arguments to PROGRAM.
|
|
175
|
|
176 If BUFFER is 0, `call-process' returns immediately with value nil.
|
|
177 Otherwise it waits for PROGRAM to terminate and returns a numeric exit status
|
|
178 or a signal description string.
|
|
179 If you quit, the process is killed with SIGINT, or SIGKILL if you
|
|
180 quit again.
|
20
|
181 */
|
|
182 (int nargs, Lisp_Object *args))
|
0
|
183 {
|
|
184 /* This function can GC */
|
|
185 Lisp_Object infile, buffer, current_dir, display, path;
|
|
186 int fd[2];
|
|
187 int filefd;
|
|
188 int pid;
|
|
189 char buf[16384];
|
|
190 char *bufptr = buf;
|
|
191 int bufsize = 16384;
|
|
192 int speccount = specpdl_depth ();
|
116
|
193 struct gcpro gcpro1;
|
0
|
194 char **new_argv
|
|
195 = (char **) alloca ((max (2, nargs - 2)) * sizeof (char *));
|
|
196
|
|
197 /* File to use for stderr in the child.
|
|
198 t means use same as standard output. */
|
|
199 Lisp_Object error_file;
|
|
200 #ifdef MSDOS
|
|
201 char *outf, *tempfile;
|
|
202 int outfilefd;
|
14
|
203 #endif /* MSDOS */
|
0
|
204
|
|
205 CHECK_STRING (args[0]);
|
|
206
|
|
207 error_file = Qt;
|
|
208
|
80
|
209 #if defined (NO_SUBPROCESSES)
|
0
|
210 /* Without asynchronous processes we cannot have BUFFER == 0. */
|
|
211 if (nargs >= 3 && !INTP (args[2]))
|
|
212 error ("Operating system cannot handle asynchronous subprocesses");
|
14
|
213 #endif /* NO_SUBPROCESSES */
|
0
|
214
|
|
215 /* Do this before building new_argv because GC in Lisp code
|
|
216 * called by various filename-hacking routines might relocate strings */
|
|
217 locate_file (Vexec_path, args[0], EXEC_SUFFIXES, &path, X_OK);
|
|
218
|
|
219 /* Make sure that the child will be able to chdir to the current
|
|
220 buffer's current directory, or its unhandled equivalent. We
|
|
221 can't just have the child check for an error when it does the
|
|
222 chdir, since it's in a vfork. */
|
|
223 {
|
|
224 struct gcpro gcpro1, gcpro2;
|
|
225 /* Do this test before building new_argv because GC in Lisp code
|
|
226 * called by various filename-hacking routines might relocate strings */
|
|
227 /* Make sure that the child will be able to chdir to the current
|
|
228 buffer's current directory. We can't just have the child check
|
|
229 for an error when it does the chdir, since it's in a vfork. */
|
|
230
|
|
231 GCPRO2 (current_dir, path); /* Caller gcprotects args[] */
|
|
232 current_dir = current_buffer->directory;
|
116
|
233 current_dir = Funhandled_file_name_directory (current_dir);
|
|
234 current_dir = expand_and_dir_to_file (current_dir, Qnil);
|
0
|
235 #if 0
|
|
236 /* I don't know how RMS intends this crock of shit to work, but it
|
|
237 breaks everything in the presence of ange-ftp-visited files, so
|
|
238 fuck it. */
|
|
239 if (NILP (Ffile_accessible_directory_p (current_dir)))
|
|
240 report_file_error ("Setting current directory",
|
|
241 Fcons (current_buffer->directory, Qnil));
|
|
242 #endif /* 0 */
|
|
243 UNGCPRO;
|
|
244 }
|
|
245
|
|
246 if (nargs >= 2 && ! NILP (args[1]))
|
|
247 {
|
116
|
248 struct gcpro gcpro1;
|
|
249 GCPRO1 (current_buffer->directory);
|
14
|
250 infile = Fexpand_file_name (args[1], current_buffer->directory);
|
116
|
251 UNGCPRO;
|
0
|
252 CHECK_STRING (infile);
|
|
253 }
|
|
254 else
|
|
255 infile = build_string (NULL_DEVICE);
|
|
256
|
116
|
257 GCPRO1 (infile); /* Fexpand_file_name might trash it */
|
|
258
|
0
|
259 if (nargs >= 3)
|
|
260 {
|
|
261 buffer = args[2];
|
|
262
|
|
263 /* If BUFFER is a list, its meaning is
|
|
264 (BUFFER-FOR-STDOUT FILE-FOR-STDERR). */
|
|
265 if (CONSP (buffer))
|
|
266 {
|
|
267 if (CONSP (XCDR (buffer)))
|
|
268 {
|
|
269 Lisp_Object file_for_stderr = XCAR (XCDR (buffer));
|
|
270
|
|
271 if (NILP (file_for_stderr) || EQ (Qt, file_for_stderr))
|
|
272 error_file = file_for_stderr;
|
|
273 else
|
|
274 error_file = Fexpand_file_name (file_for_stderr, Qnil);
|
|
275 }
|
|
276
|
|
277 buffer = XCAR (buffer);
|
|
278 }
|
|
279
|
|
280 if (!(EQ (buffer, Qnil)
|
|
281 || EQ (buffer, Qt)
|
|
282 || ZEROP (buffer)))
|
|
283 {
|
|
284 Lisp_Object spec_buffer;
|
|
285 spec_buffer = buffer;
|
|
286 buffer = Fget_buffer (buffer);
|
|
287 /* Mention the buffer name for a better error message. */
|
|
288 if (NILP (buffer))
|
|
289 CHECK_BUFFER (spec_buffer);
|
|
290 CHECK_BUFFER (buffer);
|
|
291 }
|
|
292 }
|
|
293 else
|
|
294 buffer = Qnil;
|
|
295
|
116
|
296 UNGCPRO;
|
|
297
|
0
|
298 display = ((nargs >= 4) ? args[3] : Qnil);
|
|
299
|
14
|
300 /* From here we assume we won't GC (unless an error is signaled). */
|
0
|
301 {
|
|
302 REGISTER int i;
|
|
303 for (i = 4; i < nargs; i++)
|
|
304 {
|
|
305 CHECK_STRING (args[i]);
|
14
|
306 new_argv[i - 3] = (char *) XSTRING_DATA (args[i]);
|
0
|
307 }
|
20
|
308 new_argv[nargs - 3] = 0;
|
0
|
309 }
|
|
310
|
20
|
311 if (NILP (path))
|
|
312 report_file_error ("Searching for program", Fcons (args[0], Qnil));
|
|
313 new_argv[0] = (char *) XSTRING_DATA (path);
|
|
314
|
14
|
315 filefd = open ((char *) XSTRING_DATA (infile), O_RDONLY, 0);
|
0
|
316 if (filefd < 0)
|
20
|
317 report_file_error ("Opening process input file", Fcons (infile, Qnil));
|
0
|
318
|
|
319 #ifdef MSDOS
|
|
320 /* These vars record information from process termination.
|
|
321 Clear them now before process can possibly terminate,
|
|
322 to avoid timing error if process terminates soon. */
|
|
323 synch_process_death = 0;
|
|
324 synch_process_retcode = 0;
|
|
325
|
|
326 if ((outf = egetenv ("TMP")) || (outf = egetenv ("TEMP")))
|
|
327 strcpy (tempfile = alloca (strlen (outf) + 20), outf);
|
|
328 else
|
|
329 {
|
|
330 tempfile = alloca (20);
|
|
331 *tempfile = '\0';
|
|
332 }
|
|
333 dostounix_filename (tempfile);
|
|
334 if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/')
|
|
335 strcat (tempfile, "/");
|
|
336 strcat (tempfile, "detmp.XXX");
|
|
337 mktemp (tempfile);
|
|
338
|
|
339 outfilefd = creat (tempfile, S_IREAD | S_IWRITE);
|
|
340 if (outfilefd < 0)
|
|
341 {
|
|
342 close (filefd);
|
|
343 report_file_error ("Opening process output file",
|
|
344 Fcons (tempfile, Qnil));
|
|
345 }
|
14
|
346 #endif /* MSDOS */
|
0
|
347
|
|
348 #ifndef MSDOS
|
|
349 if (INTP (buffer))
|
|
350 {
|
|
351 fd[1] = open (NULL_DEVICE, O_WRONLY, 0);
|
|
352 fd[0] = -1;
|
|
353 }
|
|
354 else
|
|
355 {
|
|
356 pipe (fd);
|
|
357 #if 0
|
|
358 /* Replaced by close_process_descs */
|
|
359 set_exclusive_use (fd[0]);
|
|
360 #endif
|
|
361 }
|
|
362 #else /* MSDOS */
|
|
363 {
|
|
364 char *outf;
|
|
365
|
|
366 if (INTP (buffer))
|
|
367 outf = NULL_DEVICE;
|
|
368 else
|
|
369 {
|
|
370 /* DOS can't create pipe for interprocess communication,
|
|
371 so redirect child process's standard output to temporary file
|
|
372 and later read the file. */
|
|
373
|
|
374 if ((outf = egetenv ("TMP")) || (outf = egetenv ("TEMP")))
|
|
375 {
|
|
376 strcpy (tempfile, outf);
|
|
377 dostounix_filename (tempfile);
|
|
378 }
|
|
379 else
|
|
380 *tempfile = '\0';
|
|
381 if (strlen (tempfile) == 0 || tempfile[strlen (tempfile) - 1] != '/')
|
|
382 strcat (tempfile, "/");
|
|
383 strcat (tempfile, "demacs.XXX");
|
|
384 mktemp (tempfile);
|
|
385 outf = tempfile;
|
|
386 }
|
|
387
|
|
388 if ((fd[1] = creat (outf, S_IREAD | S_IWRITE)) < 0)
|
|
389 report_file_error ("Can't open temporary file", Qnil);
|
|
390 fd[0] = -1;
|
|
391 }
|
|
392 #endif /* MSDOS */
|
|
393
|
|
394 {
|
|
395 /* child_setup must clobber environ in systems with true vfork.
|
|
396 Protect it from permanent change. */
|
|
397 REGISTER char **save_environ = environ;
|
|
398 REGISTER int fd1 = fd[1];
|
|
399 int fd_error = fd1;
|
|
400 char **env;
|
|
401
|
|
402 #ifdef EMACS_BTL
|
|
403 /* when performance monitoring is on, turn it off before the vfork(),
|
|
404 as the child has no handler for the signal -- when back in the
|
|
405 parent process, turn it back on if it was really on when you "turned
|
|
406 it off" */
|
|
407 int logging_on = cadillac_stop_logging ();
|
14
|
408 #endif /* EMACS_BTL */
|
0
|
409
|
|
410 env = environ;
|
|
411
|
|
412 /* Record that we're about to create a synchronous process. */
|
|
413 synch_process_alive = 1;
|
|
414
|
|
415 /* These vars record information from process termination.
|
|
416 Clear them now before process can possibly terminate,
|
|
417 to avoid timing error if process terminates soon. */
|
|
418 synch_process_death = 0;
|
|
419 synch_process_retcode = 0;
|
|
420
|
|
421 #ifdef MSDOS
|
|
422 /* ??? Someone who knows MSDOG needs to check whether this properly
|
|
423 closes all descriptors that it opens. */
|
|
424 pid = run_msdos_command (new_argv, current_dir, filefd, outfilefd);
|
|
425 close (outfilefd);
|
|
426 fd1 = -1; /* No harm in closing that one! */
|
|
427 fd[0] = open (tempfile, NILP (Vbinary_process_output) ? O_TEXT :
|
|
428 O_BINARY);
|
|
429 if (fd[0] < 0)
|
|
430 {
|
|
431 unlink (tempfile);
|
|
432 close (filefd);
|
|
433 report_file_error ("Cannot re-open temporary file", Qnil);
|
|
434 }
|
|
435 #else /* not MSDOS */
|
|
436 if (NILP (error_file))
|
|
437 fd_error = open (NULL_DEVICE, O_WRONLY);
|
|
438 else if (STRINGP (error_file))
|
|
439 {
|
|
440 #ifdef DOS_NT
|
14
|
441 fd_error = open (XSTRING_DATA (error_file),
|
0
|
442 O_WRONLY | O_TRUNC | O_CREAT | O_TEXT,
|
|
443 S_IREAD | S_IWRITE);
|
|
444 #else /* not DOS_NT */
|
|
445 fd_error =
|
14
|
446 creat ((CONST char *) XSTRING_DATA (error_file), 0666);
|
0
|
447 #endif /* not DOS_NT */
|
|
448 }
|
|
449
|
|
450 if (fd_error < 0)
|
|
451 {
|
|
452 close (filefd);
|
|
453 close (fd[0]);
|
|
454 if (fd1 >= 0)
|
|
455 close (fd1);
|
70
|
456 report_file_error ("Cannot open", error_file);
|
0
|
457 }
|
|
458
|
|
459 fork_error = Qnil;
|
|
460 #ifdef WINDOWSNT
|
|
461 pid = child_setup (filefd, fd1, fd_error, new_argv, current_dir);
|
|
462 #else /* not WINDOWSNT */
|
|
463 pid = vfork ();
|
|
464
|
|
465 if (pid == 0)
|
|
466 {
|
|
467 if (fd[0] >= 0)
|
|
468 close (fd[0]);
|
|
469 /* This is necessary because some shells may attempt to
|
|
470 access the current controlling terminal and will hang
|
|
471 if they are run in the background, as will be the case
|
|
472 when XEmacs is started in the background. Martin
|
|
473 Buchholz observed this problem running a subprocess
|
|
474 that used zsh to call gzip to uncompress an info
|
|
475 file. */
|
|
476 disconnect_controlling_terminal ();
|
|
477 child_setup (filefd, fd1, fd_error, new_argv,
|
14
|
478 (char *) XSTRING_DATA (current_dir));
|
0
|
479 }
|
|
480 #ifdef EMACS_BTL
|
|
481 else if (logging_on)
|
|
482 cadillac_start_logging ();
|
|
483 #endif
|
|
484
|
|
485 #endif /* not MSDOS */
|
|
486 #endif /* not WINDOWSNT */
|
|
487
|
|
488 environ = save_environ;
|
|
489
|
|
490 /* Close most of our fd's, but not fd[0]
|
|
491 since we will use that to read input from. */
|
|
492 close (filefd);
|
|
493 if (fd1 >= 0)
|
|
494 close (fd1);
|
|
495 }
|
|
496
|
|
497 if (!NILP (fork_error))
|
|
498 signal_error (Qfile_error, fork_error);
|
|
499
|
|
500 if (pid < 0)
|
|
501 {
|
|
502 if (fd[0] >= 0)
|
|
503 close (fd[0]);
|
|
504 report_file_error ("Doing vfork", Qnil);
|
|
505 }
|
|
506
|
|
507 if (INTP (buffer))
|
|
508 {
|
|
509 if (fd[0] >= 0)
|
|
510 close (fd[0]);
|
80
|
511 #if defined (NO_SUBPROCESSES)
|
0
|
512 /* If Emacs has been built with asynchronous subprocess support,
|
|
513 we don't need to do this, I think because it will then have
|
|
514 the facilities for handling SIGCHLD. */
|
|
515 wait_without_blocking ();
|
14
|
516 #endif /* NO_SUBPROCESSES */
|
0
|
517 return Qnil;
|
|
518 }
|
|
519
|
|
520 {
|
|
521 int nread;
|
|
522 int first = 1;
|
|
523 int total_read = 0;
|
|
524 Lisp_Object instream;
|
|
525 struct gcpro gcpro1;
|
|
526
|
|
527 /* Enable sending signal if user quits below. */
|
|
528 call_process_exited = 0;
|
|
529
|
|
530 #ifdef MSDOS
|
|
531 /* MSDOS needs different cleanup information. */
|
|
532 record_unwind_protect (call_process_cleanup,
|
|
533 Fcons (make_int (fd[0]),
|
|
534 build_string (tempfile)));
|
14
|
535 #else /* not MSDOS */
|
0
|
536 record_unwind_protect (call_process_cleanup,
|
|
537 Fcons (make_int (fd[0]), make_int (pid)));
|
|
538 #endif /* not MSDOS */
|
|
539
|
|
540 /* FSFmacs calls Fset_buffer() here. We don't have to because
|
|
541 we can insert into buffers other than the current one. */
|
|
542 if (EQ (buffer, Qt))
|
|
543 XSETBUFFER (buffer, current_buffer);
|
|
544 instream = make_filedesc_input_stream (fd[0], 0, -1, LSTR_ALLOW_QUIT);
|
70
|
545 #ifdef MULE
|
|
546 instream =
|
|
547 make_decoding_input_stream
|
|
548 (XLSTREAM (instream),
|
120
|
549 Fget_coding_system (Vcoding_system_for_read));
|
70
|
550 Lstream_set_character_mode (XLSTREAM (instream));
|
|
551 #endif /* MULE */
|
0
|
552 GCPRO1 (instream);
|
|
553 while (1)
|
|
554 {
|
|
555 QUIT;
|
|
556 /* Repeatedly read until we've filled as much as possible
|
|
557 of the buffer size we have. But don't read
|
|
558 less than 1024--save that for the next bufferfull. */
|
|
559
|
|
560 nread = 0;
|
|
561 while (nread < bufsize - 1024)
|
|
562 {
|
|
563 int this_read
|
|
564 = Lstream_read (XLSTREAM (instream), bufptr + nread,
|
|
565 bufsize - nread);
|
|
566
|
|
567 if (this_read < 0)
|
|
568 goto give_up;
|
|
569
|
|
570 if (this_read == 0)
|
|
571 goto give_up_1;
|
|
572
|
|
573 nread += this_read;
|
|
574 }
|
|
575
|
|
576 give_up_1:
|
|
577
|
|
578 /* Now NREAD is the total amount of data in the buffer. */
|
|
579 if (nread == 0)
|
|
580 break;
|
|
581
|
|
582 total_read += nread;
|
|
583
|
|
584 if (!NILP (buffer))
|
|
585 buffer_insert_raw_string (XBUFFER (buffer), (Bufbyte *) bufptr,
|
|
586 nread);
|
|
587
|
|
588 /* Make the buffer bigger as we continue to read more data,
|
|
589 but not past 64k. */
|
|
590 if (bufsize < 64 * 1024 && total_read > 32 * bufsize)
|
|
591 {
|
|
592 bufsize *= 2;
|
|
593 bufptr = (char *) alloca (bufsize);
|
|
594 }
|
|
595
|
|
596 if (!NILP (display) && INTERACTIVE)
|
|
597 {
|
|
598 first = 0;
|
|
599 redisplay ();
|
|
600 }
|
|
601 }
|
|
602 give_up:
|
|
603 Lstream_close (XLSTREAM (instream));
|
|
604 UNGCPRO;
|
|
605
|
|
606 QUIT;
|
|
607 #ifndef MSDOS
|
|
608 /* Wait for it to terminate, unless it already has. */
|
|
609 wait_for_termination (pid);
|
|
610 #endif
|
|
611
|
|
612 /* Don't kill any children that the subprocess may have left behind
|
|
613 when exiting. */
|
|
614 call_process_exited = 1;
|
|
615 unbind_to (speccount, Qnil);
|
|
616
|
|
617 if (synch_process_death)
|
|
618 return build_string (synch_process_death);
|
|
619 return make_int (synch_process_retcode);
|
|
620 }
|
|
621 }
|
|
622
|
|
623 #endif /* VMS */
|
|
624
|
|
625 #ifndef VMS /* VMS version is in vmsproc.c. */
|
|
626
|
|
627 /* This is the last thing run in a newly forked inferior
|
|
628 either synchronous or asynchronous.
|
|
629 Copy descriptors IN, OUT and ERR as descriptors 0, 1 and 2.
|
|
630 Initialize inferior's priority, pgrp, connected dir and environment.
|
|
631 then exec another program based on new_argv.
|
|
632
|
|
633 This function may change environ for the superior process.
|
|
634 Therefore, the superior process must save and restore the value
|
|
635 of environ around the vfork and the call to this function.
|
|
636
|
|
637 ENV is the environment for the subprocess.
|
|
638
|
|
639 XEmacs: We've removed the SET_PGRP argument because it's already
|
|
640 done by the callers of child_setup.
|
|
641
|
|
642 CURRENT_DIR is an elisp string giving the path of the current
|
|
643 directory the subprocess should have. Since we can't really signal
|
|
644 a decent error from within the child, this should be verified as an
|
|
645 executable directory by the parent. */
|
|
646
|
|
647 static int relocate_fd (int fd, int min);
|
|
648
|
100
|
649 #ifdef WINDOWSNT
|
|
650 int
|
|
651 #else
|
0
|
652 void
|
100
|
653 #endif
|
0
|
654 child_setup (int in, int out, int err, char **new_argv,
|
|
655 CONST char *current_dir)
|
|
656 {
|
|
657 #ifdef MSDOS
|
|
658 /* The MSDOS port of gcc cannot fork, vfork, ... so we must call system
|
|
659 instead. */
|
|
660 #else /* not MSDOS */
|
|
661 char **env;
|
|
662 char *pwd;
|
|
663 #ifdef WINDOWSNT
|
|
664 int cpid;
|
|
665 HANDLE handles[4];
|
|
666 #endif /* WINDOWSNT */
|
|
667
|
|
668 #ifdef SET_EMACS_PRIORITY
|
|
669 if (emacs_priority != 0)
|
|
670 nice (- emacs_priority);
|
|
671 #endif
|
|
672
|
80
|
673 #if !defined (NO_SUBPROCESSES)
|
0
|
674 /* Close Emacs's descriptors that this process should not have. */
|
|
675 close_process_descs ();
|
20
|
676 #endif /* not NO_SUBPROCESSES */
|
0
|
677 close_load_descs ();
|
|
678
|
|
679 /* Note that use of alloca is always safe here. It's obvious for systems
|
|
680 that do not have true vfork or that have true (stack) alloca.
|
|
681 If using vfork and C_ALLOCA it is safe because that changes
|
|
682 the superior's static variables as if the superior had done alloca
|
|
683 and will be cleaned up in the usual way. */
|
|
684 {
|
|
685 REGISTER int i;
|
|
686
|
|
687 i = strlen (current_dir);
|
|
688 pwd = (char *) alloca (i + 6);
|
|
689 memcpy (pwd, "PWD=", 4);
|
|
690 memcpy (pwd + 4, current_dir, i);
|
|
691 i += 4;
|
|
692 if (!IS_DIRECTORY_SEP (pwd[i - 1]))
|
|
693 pwd[i++] = DIRECTORY_SEP;
|
|
694 pwd[i] = 0;
|
|
695
|
|
696 /* We can't signal an Elisp error here; we're in a vfork. Since
|
|
697 the callers check the current directory before forking, this
|
|
698 should only return an error if the directory's permissions
|
|
699 are changed between the check and this chdir, but we should
|
|
700 at least check. */
|
|
701 if (chdir (pwd + 4) < 0)
|
|
702 {
|
|
703 /* Don't report the chdir error, or ange-ftp.el doesn't work. */
|
|
704 /* (FSFmacs does _exit (errno) here.) */
|
|
705 pwd = 0;
|
|
706 }
|
|
707 else
|
|
708 {
|
|
709 /* Strip trailing "/". Cretinous *[]&@$#^%@#$% Un*x */
|
|
710 /* leave "//" (from FSF) */
|
|
711 while (i > 6 && IS_DIRECTORY_SEP (pwd[i - 1]))
|
|
712 pwd[--i] = 0;
|
|
713 }
|
|
714 }
|
|
715
|
|
716 /* Set `env' to a vector of the strings in Vprocess_environment. */
|
|
717 {
|
|
718 REGISTER Lisp_Object tem;
|
|
719 REGISTER char **new_env;
|
|
720 REGISTER int new_length;
|
|
721
|
|
722 new_length = 0;
|
|
723 for (tem = Vprocess_environment;
|
|
724 (CONSP (tem)
|
|
725 && STRINGP (XCAR (tem)));
|
|
726 tem = XCDR (tem))
|
|
727 new_length++;
|
|
728
|
|
729 /* new_length + 2 to include PWD and terminating 0. */
|
|
730 env = new_env = (char **) alloca ((new_length + 2) * sizeof (char *));
|
|
731
|
|
732 /* If we have a PWD envvar and we know the real current directory,
|
|
733 pass one down, but with corrected value. */
|
|
734 if (pwd && getenv ("PWD"))
|
|
735 *new_env++ = pwd;
|
|
736
|
|
737 /* Copy the Vprocess_environment strings into new_env. */
|
|
738 for (tem = Vprocess_environment;
|
|
739 (CONSP (tem)
|
|
740 && STRINGP (XCAR (tem)));
|
|
741 tem = XCDR (tem))
|
|
742 {
|
|
743 char **ep = env;
|
14
|
744 char *string = (char *) XSTRING_DATA (XCAR (tem));
|
0
|
745 /* See if this string duplicates any string already in the env.
|
|
746 If so, don't put it in.
|
|
747 When an env var has multiple definitions,
|
|
748 we keep the definition that comes first in process-environment. */
|
|
749 for (; ep != new_env; ep++)
|
|
750 {
|
|
751 char *p = *ep, *q = string;
|
|
752 while (1)
|
|
753 {
|
|
754 if (*q == 0)
|
|
755 /* The string is malformed; might as well drop it. */
|
|
756 goto duplicate;
|
|
757 if (*q != *p)
|
|
758 break;
|
|
759 if (*q == '=')
|
|
760 goto duplicate;
|
|
761 p++, q++;
|
|
762 }
|
|
763 }
|
|
764 if (pwd && !strncmp ("PWD=", string, 4))
|
|
765 {
|
|
766 *new_env++ = pwd;
|
|
767 pwd = 0;
|
|
768 }
|
|
769 else
|
|
770 *new_env++ = string;
|
|
771 duplicate: ;
|
|
772 }
|
|
773 *new_env = 0;
|
|
774 }
|
|
775 #ifdef WINDOWSNT
|
|
776 prepare_standard_handles (in, out, err, handles);
|
|
777 #else /* not WINDOWSNT */
|
|
778 /* Make sure that in, out, and err are not actually already in
|
|
779 descriptors zero, one, or two; this could happen if Emacs is
|
|
780 started with its standard in, out, or error closed, as might
|
|
781 happen under X. */
|
|
782 {
|
|
783 int oin = in, oout = out;
|
|
784
|
|
785 /* We have to avoid relocating the same descriptor twice! */
|
|
786
|
|
787 in = relocate_fd (in, 3);
|
|
788
|
|
789 if (out == oin) out = in;
|
|
790 else out = relocate_fd (out, 3);
|
|
791
|
|
792 if (err == oin) err = in;
|
|
793 else if (err == oout) err = out;
|
|
794 else err = relocate_fd (err, 3);
|
|
795 }
|
|
796
|
|
797 close (0);
|
|
798 close (1);
|
|
799 close (2);
|
|
800
|
|
801 dup2 (in, 0);
|
|
802 dup2 (out, 1);
|
|
803 dup2 (err, 2);
|
|
804
|
|
805 close (in);
|
|
806 close (out);
|
|
807 close (err);
|
|
808
|
|
809 /* I can't think of any reason why child processes need any more
|
|
810 than the standard 3 file descriptors. It would be cleaner to
|
|
811 close just the ones that need to be, but the following brute
|
|
812 force approach is certainly effective, and not too slow. */
|
|
813 {
|
|
814 int fd;
|
|
815 for (fd=3; fd<=64; fd++)
|
|
816 {
|
|
817 close(fd);
|
|
818 }
|
|
819 }
|
|
820 #endif /* not WINDOWSNT */
|
|
821
|
|
822 #ifdef vipc
|
|
823 something missing here;
|
|
824 #endif /* vipc */
|
|
825
|
|
826 #ifdef WINDOWSNT
|
|
827 /* Spawn the child. (See ntproc.c:Spawnve). */
|
|
828 cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
|
|
829 if (cpid == -1)
|
|
830 /* An error occurred while trying to spawn the process. */
|
|
831 report_file_error ("Spawning child process", Qnil);
|
|
832 reset_standard_handles (in, out, err, handles);
|
|
833 return cpid;
|
|
834 #else /* not WINDOWSNT */
|
|
835 /* execvp does not accept an environment arg so the only way
|
|
836 to pass this environment is to set environ. Our caller
|
|
837 is responsible for restoring the ambient value of environ. */
|
|
838 environ = env;
|
|
839 execvp (new_argv[0], new_argv);
|
|
840
|
|
841 stdout_out ("Cant't exec program %s\n", new_argv[0]);
|
|
842 _exit (1);
|
|
843 #endif /* not WINDOWSNT */
|
|
844 #endif /* not MSDOS */
|
|
845 }
|
|
846
|
|
847 /* Move the file descriptor FD so that its number is not less than MIN.
|
|
848 If the file descriptor is moved at all, the original is freed. */
|
|
849 static int
|
|
850 relocate_fd (int fd, int min)
|
|
851 {
|
|
852 if (fd >= min)
|
|
853 return fd;
|
|
854 else
|
|
855 {
|
|
856 int new = dup (fd);
|
|
857 if (new == -1)
|
|
858 {
|
|
859 stderr_out ("Error while setting up child: %s\n",
|
|
860 strerror (errno));
|
|
861 _exit (1);
|
|
862 }
|
|
863 /* Note that we hold the original FD open while we recurse,
|
|
864 to guarantee we'll get a new FD if we need it. */
|
|
865 new = relocate_fd (new, min);
|
|
866 close (fd);
|
|
867 return new;
|
|
868 }
|
|
869 }
|
|
870
|
|
871 static int
|
|
872 getenv_internal (CONST Bufbyte *var,
|
|
873 Bytecount varlen,
|
|
874 Bufbyte **value,
|
|
875 Bytecount *valuelen)
|
|
876 {
|
|
877 Lisp_Object scan;
|
|
878
|
|
879 for (scan = Vprocess_environment; CONSP (scan); scan = XCDR (scan))
|
|
880 {
|
|
881 Lisp_Object entry = XCAR (scan);
|
|
882
|
|
883 if (STRINGP (entry)
|
14
|
884 && XSTRING_LENGTH (entry) > varlen
|
80
|
885 && XSTRING_BYTE (entry, varlen) == '='
|
0
|
886 #ifdef WINDOWSNT
|
|
887 /* NT environment variables are case insensitive. */
|
14
|
888 && ! memicmp (XSTRING_DATA (entry), var, varlen)
|
0
|
889 #else /* not WINDOWSNT */
|
14
|
890 && ! memcmp (XSTRING_DATA (entry), var, varlen)
|
0
|
891 #endif /* not WINDOWSNT */
|
|
892 )
|
|
893 {
|
14
|
894 *value = XSTRING_DATA (entry) + (varlen + 1);
|
|
895 *valuelen = XSTRING_LENGTH (entry) - (varlen + 1);
|
0
|
896 return 1;
|
|
897 }
|
|
898 }
|
|
899
|
|
900 return 0;
|
|
901 }
|
|
902
|
20
|
903 DEFUN ("getenv", Fgetenv, 1, 2, "sEnvironment variable: \np", /*
|
0
|
904 Return the value of environment variable VAR, as a string.
|
|
905 VAR is a string, the name of the variable.
|
|
906 When invoked interactively, prints the value in the echo area.
|
20
|
907 */
|
|
908 (var, interactivep))
|
0
|
909 {
|
|
910 Bufbyte *value;
|
|
911 Bytecount valuelen;
|
|
912 Lisp_Object v = Qnil;
|
|
913 struct gcpro gcpro1;
|
|
914
|
|
915 CHECK_STRING (var);
|
|
916 GCPRO1 (v);
|
14
|
917 if (getenv_internal (XSTRING_DATA (var), XSTRING_LENGTH (var),
|
0
|
918 &value, &valuelen))
|
|
919 v = make_string (value, valuelen);
|
|
920 if (!NILP (interactivep))
|
|
921 {
|
|
922 if (NILP (v))
|
14
|
923 message ("%s not defined in environment", XSTRING_DATA (var));
|
0
|
924 else
|
|
925 message ("\"%s\"", value);
|
|
926 }
|
|
927 RETURN_UNGCPRO (v);
|
|
928 }
|
|
929
|
|
930 /* A version of getenv that consults process_environment, easily
|
|
931 callable from C. */
|
|
932 char *
|
|
933 egetenv (CONST char *var)
|
|
934 {
|
|
935 Bufbyte *value;
|
|
936 Bytecount valuelen;
|
|
937
|
|
938 if (getenv_internal ((CONST Bufbyte *) var, strlen (var), &value, &valuelen))
|
|
939 return (char *) value;
|
|
940 else
|
|
941 return 0;
|
|
942 }
|
|
943 #endif /* not VMS */
|
|
944
|
|
945
|
|
946 void
|
|
947 init_callproc (void)
|
|
948 {
|
|
949 /* This function can GC */
|
|
950 REGISTER char *sh;
|
|
951 Lisp_Object tempdir;
|
|
952
|
|
953 Vprocess_environment = Qnil;
|
|
954 /* jwz: always initialize Vprocess_environment, so that egetenv() works
|
|
955 in temacs. */
|
|
956 {
|
|
957 char **envp;
|
|
958 for (envp = environ; envp && *envp; envp++)
|
|
959 Vprocess_environment = Fcons (build_ext_string (*envp, FORMAT_OS),
|
|
960 Vprocess_environment);
|
|
961 }
|
|
962
|
|
963 /* jwz: don't do these things when in temacs (this used to be the case by
|
|
964 virtue of egetenv() always returning 0, but that has been changed).
|
|
965 */
|
|
966 #ifndef CANNOT_DUMP
|
|
967 if (!initialized)
|
|
968 {
|
|
969 Vdata_directory = Qnil;
|
110
|
970 Vsite_directory = Qnil;
|
14
|
971 Vdoc_directory = Qnil;
|
|
972 Vexec_path = Qnil;
|
0
|
973 }
|
|
974 else
|
|
975 #endif
|
|
976 {
|
|
977 char *data_dir = egetenv ("EMACSDATA");
|
110
|
978 char *site_dir = egetenv ("EMACSSITE");
|
14
|
979 char *doc_dir = egetenv ("EMACSDOC");
|
0
|
980
|
|
981 #ifdef PATH_DATA
|
|
982 if (!data_dir)
|
|
983 data_dir = (char *) PATH_DATA;
|
|
984 #endif
|
|
985 #ifdef PATH_DOC
|
|
986 if (!doc_dir)
|
|
987 doc_dir = (char *) PATH_DOC;
|
|
988 #endif
|
110
|
989 #ifdef PATH_SITE
|
|
990 if (!site_dir)
|
|
991 site_dir = (char *) PATH_SITE;
|
|
992 #endif
|
0
|
993
|
|
994 if (data_dir)
|
|
995 Vdata_directory = Ffile_name_as_directory
|
|
996 (build_string (data_dir));
|
|
997 else
|
|
998 Vdata_directory = Qnil;
|
|
999 if (doc_dir)
|
|
1000 Vdoc_directory = Ffile_name_as_directory
|
|
1001 (build_string (doc_dir));
|
|
1002 else
|
|
1003 Vdoc_directory = Qnil;
|
110
|
1004 if (site_dir)
|
|
1005 Vsite_directory = Ffile_name_as_directory
|
|
1006 (build_string (site_dir));
|
|
1007 else
|
|
1008 Vsite_directory = Qnil;
|
0
|
1009
|
|
1010 /* Check the EMACSPATH environment variable, defaulting to the
|
|
1011 PATH_EXEC path from paths.h. */
|
|
1012 Vexec_path = decode_env_path ("EMACSPATH",
|
|
1013 #ifdef PATH_EXEC
|
|
1014 PATH_EXEC
|
|
1015 #else
|
|
1016 0
|
|
1017 #endif
|
|
1018 );
|
|
1019 }
|
|
1020
|
|
1021 if (NILP (Vexec_path))
|
|
1022 Vexec_directory = Qnil;
|
|
1023 else
|
|
1024 Vexec_directory = Ffile_name_as_directory
|
|
1025 (Fcar (Vexec_path));
|
|
1026
|
|
1027 if (initialized)
|
|
1028 Vexec_path = nconc2 (decode_env_path ("PATH", 0),
|
|
1029 Vexec_path);
|
|
1030
|
|
1031 if (!NILP (Vexec_directory))
|
|
1032 {
|
|
1033 tempdir = Fdirectory_file_name (Vexec_directory);
|
14
|
1034 if (access ((char *) XSTRING_DATA (tempdir), 0) < 0)
|
0
|
1035 {
|
|
1036 /* If the hard-coded path is bogus, fail silently.
|
|
1037 This will allow the normal heuristics to make an attempt. */
|
|
1038 #if 0
|
|
1039 warn_when_safe
|
|
1040 (Qpath, Qwarning,
|
|
1041 "Warning: machine-dependent data dir (%s) does not exist.\n",
|
14
|
1042 XSTRING_DATA (Vexec_directory));
|
0
|
1043 #else
|
|
1044 Vexec_directory = Qnil;
|
|
1045 #endif
|
|
1046 }
|
|
1047 }
|
|
1048
|
|
1049 if (!NILP (Vdata_directory))
|
|
1050 {
|
|
1051 tempdir = Fdirectory_file_name (Vdata_directory);
|
14
|
1052 if (access ((char *) XSTRING_DATA (tempdir), 0) < 0)
|
0
|
1053 {
|
|
1054 /* If the hard-coded path is bogus, fail silently.
|
|
1055 This will allow the normal heuristics to make an attempt. */
|
|
1056 #if 0
|
|
1057 warn_when_safe
|
|
1058 (Qpath, Qwarning,
|
|
1059 "Warning: machine-independent data dir (%s) does not exist.\n",
|
14
|
1060 XSTRING_DATA (Vdata_directory));
|
0
|
1061 #else
|
|
1062 Vdata_directory = Qnil;
|
|
1063 #endif
|
|
1064 }
|
|
1065 }
|
|
1066
|
110
|
1067 if (!NILP (Vsite_directory))
|
|
1068 {
|
|
1069 tempdir = Fdirectory_file_name (Vsite_directory);
|
|
1070 if (access ((char *) XSTRING_DATA (tempdir), 0) < 0)
|
|
1071 {
|
|
1072 /* If the hard-coded path is bogus, fail silently.
|
|
1073 This will allow the normal heuristics to make an attempt. */
|
|
1074 #if 0
|
|
1075 warn_when_safe
|
|
1076 (Qpath, Qwarning,
|
|
1077 "Warning: machine-independent site dir (%s) does not exist.\n",
|
|
1078 XSTRING_DATA (Vsite_directory));
|
|
1079 #else
|
|
1080 Vsite_directory = Qnil;
|
|
1081 #endif
|
|
1082 }
|
|
1083 }
|
|
1084
|
0
|
1085 #ifdef PATH_PREFIX
|
|
1086 Vprefix_directory = build_string ((char *) PATH_PREFIX);
|
|
1087 #else
|
|
1088 Vprefix_directory = Qnil;
|
|
1089 #endif
|
|
1090
|
|
1091 #ifdef VMS
|
|
1092 Vshell_file_name = build_string ("*dcl*");
|
|
1093 #else /* not VMS */
|
|
1094 sh = (char *) egetenv ("SHELL");
|
|
1095 #ifdef DOS_NT
|
|
1096 if (!sh) sh = egetenv ("COMSPEC");
|
|
1097 {
|
|
1098 char *tem;
|
|
1099 if (sh)
|
|
1100 {
|
|
1101 tem = (char *) alloca (strlen (sh) + 1);
|
|
1102 sh = dostounix_filename (strcpy (tem, sh));
|
|
1103 }
|
|
1104 }
|
|
1105 Vshell_file_name = build_string (sh ? sh : "/command.com");
|
|
1106 #else /* not DOS_NT */
|
|
1107 Vshell_file_name = build_string (sh ? sh : "/bin/sh");
|
|
1108 #endif /* not DOS_NT */
|
|
1109 #endif /* not VMS */
|
|
1110 }
|
|
1111
|
|
1112 #if 0
|
|
1113 void
|
|
1114 set_process_environment (void)
|
|
1115 {
|
|
1116 REGISTER char **envp;
|
|
1117
|
|
1118 Vprocess_environment = Qnil;
|
|
1119 #ifndef CANNOT_DUMP
|
|
1120 if (initialized)
|
|
1121 #endif
|
|
1122 for (envp = environ; *envp; envp++)
|
|
1123 Vprocess_environment = Fcons (build_string (*envp),
|
|
1124 Vprocess_environment);
|
|
1125 }
|
|
1126 #endif /* unused */
|
|
1127
|
|
1128 void
|
|
1129 syms_of_callproc (void)
|
|
1130 {
|
|
1131 #ifndef VMS
|
20
|
1132 DEFSUBR (Fcall_process_internal);
|
|
1133 DEFSUBR (Fgetenv);
|
0
|
1134 #endif
|
|
1135 }
|
|
1136
|
|
1137 void
|
|
1138 vars_of_callproc (void)
|
|
1139 {
|
|
1140 /* This function can GC */
|
|
1141 #ifdef DOS_NT
|
|
1142 DEFVAR_LISP ("binary-process-input", &Vbinary_process_input /*
|
|
1143 *If non-nil then new subprocesses are assumed to take binary input.
|
|
1144 */ );
|
|
1145 Vbinary_process_input = Qnil;
|
|
1146
|
|
1147 DEFVAR_LISP ("binary-process-output", &Vbinary_process_output /*
|
|
1148 *If non-nil then new subprocesses are assumed to produce binary output.
|
|
1149 */ );
|
|
1150 Vbinary_process_output = Qnil;
|
|
1151 #endif /* DOS_NT */
|
|
1152
|
|
1153 DEFVAR_LISP ("shell-file-name", &Vshell_file_name /*
|
|
1154 *File name to load inferior shells from.
|
|
1155 Initialized from the SHELL environment variable.
|
|
1156 */ );
|
|
1157
|
|
1158 DEFVAR_LISP ("exec-path", &Vexec_path /*
|
|
1159 *List of directories to search programs to run in subprocesses.
|
|
1160 Each element is a string (directory name) or nil (try default directory).
|
|
1161 */ );
|
|
1162
|
|
1163 DEFVAR_LISP ("exec-directory", &Vexec_directory /*
|
|
1164 Directory of architecture-dependent files that come with XEmacs,
|
|
1165 especially executable programs intended for Emacs to invoke.
|
|
1166 */ );
|
|
1167
|
|
1168 DEFVAR_LISP ("data-directory", &Vdata_directory /*
|
|
1169 Directory of architecture-independent files that come with XEmacs,
|
|
1170 intended for Emacs to use.
|
|
1171 */ );
|
|
1172
|
110
|
1173 DEFVAR_LISP ("site-directory", &Vsite_directory /*
|
|
1174 Directory of architecture-independent files that do not come with XEmacs,
|
|
1175 intended for Emacs to use.
|
|
1176 */ );
|
|
1177
|
0
|
1178 /* FSF puts the DOC file into data-directory. They do a bunch of
|
|
1179 contortions to attempt to put everything into the DOC file
|
|
1180 whether the support is there or not. */
|
|
1181 DEFVAR_LISP ("doc-directory", &Vdoc_directory /*
|
|
1182 Directory containing the DOC file that comes with XEmacs.
|
|
1183 This is usually the same as exec-directory.
|
|
1184 */ );
|
|
1185
|
|
1186 DEFVAR_LISP ("prefix-directory", &Vprefix_directory /*
|
|
1187 The default directory under which XEmacs is installed.
|
|
1188 */ );
|
|
1189
|
|
1190 DEFVAR_LISP ("process-environment", &Vprocess_environment /*
|
|
1191 List of environment variables for subprocesses to inherit.
|
|
1192 Each element should be a string of the form ENVVARNAME=VALUE.
|
|
1193 The environment which Emacs inherits is placed in this variable
|
|
1194 when Emacs starts.
|
|
1195 */ );
|
|
1196 }
|
|
1197
|
|
1198 void
|
|
1199 complex_vars_of_callproc (void)
|
|
1200 {
|
|
1201 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory /*
|
|
1202 For internal use by the build procedure only.
|
|
1203 This is the name of the directory in which the build procedure installed
|
|
1204 Emacs's info files; the default value for Info-default-directory-list
|
|
1205 includes this.
|
|
1206 */ );
|
|
1207 #ifdef PATH_INFO
|
|
1208 Vconfigure_info_directory =
|
|
1209 Ffile_name_as_directory (build_string (PATH_INFO));
|
|
1210 #else
|
|
1211 Vconfigure_info_directory = Qnil;
|
|
1212 #endif
|
|
1213 }
|