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