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