1 /* Synchronous subprocess invocation for GNU Emacs.
2 Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1999, 2000, 2001,
3 2002, 2003, 2004, 2005, 2006, 2007, 2008
4 Free Software Foundation, Inc.
6 This file is part of GNU Emacs.
8 GNU Emacs is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3, or (at your option)
13 GNU Emacs is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with GNU Emacs; see the file COPYING. If not, write to
20 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
21 Boston, MA 02110-1301, USA. */
33 /* Define SIGCHLD as an alias for SIGCLD. */
35 #if !defined (SIGCHLD) && defined (SIGCLD)
36 #define SIGCHLD SIGCLD
39 #include <sys/types.h>
47 #define INCLUDED_FCNTL
54 #include <stdlib.h> /* for proper declaration of environ */
57 #define _P_NOWAIT 1 /* from process.h */
60 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
61 #define INCLUDED_FCNTL
64 #include <sys/param.h>
79 #include "character.h"
82 #include "composite.h"
85 #include "syssignal.h"
87 #include "blockinput.h"
89 #include "termhooks.h"
96 extern noshare
char **environ
;
99 extern char **environ
;
104 #if !defined (USG) || defined (BSD_PGRPS)
106 #define setpgrp setpgid
110 Lisp_Object Vexec_path
, Vexec_directory
, Vexec_suffixes
;
111 Lisp_Object Vdata_directory
, Vdoc_directory
;
112 Lisp_Object Vconfigure_info_directory
, Vshared_game_score_directory
;
113 Lisp_Object Vtemp_file_name_pattern
;
115 Lisp_Object Vshell_file_name
;
117 Lisp_Object Vprocess_environment
, Vinitial_environment
;
120 Lisp_Object Qbuffer_file_type
;
123 /* True if we are about to fork off a synchronous process or if we
124 are waiting for it. */
125 int synch_process_alive
;
127 /* Nonzero => this is a string explaining death of synchronous subprocess. */
128 char *synch_process_death
;
130 /* Nonzero => this is the signal number that terminated the subprocess. */
131 int synch_process_termsig
;
133 /* If synch_process_death is zero,
134 this is exit code of synchronous subprocess. */
135 int synch_process_retcode
;
138 /* Clean up when exiting Fcall_process.
139 On MSDOS, delete the temporary file on any kind of termination.
140 On Unix, kill the process and any children on termination by signal. */
142 /* Nonzero if this is termination due to exit. */
143 static int call_process_exited
;
145 EXFUN (Fgetenv_internal
, 2);
147 #ifndef VMS /* VMS version is in vmsproc.c. */
150 call_process_kill (fdpid
)
153 emacs_close (XFASTINT (Fcar (fdpid
)));
154 EMACS_KILLPG (XFASTINT (Fcdr (fdpid
)), SIGKILL
);
155 synch_process_alive
= 0;
160 call_process_cleanup (fdpid
)
163 #if defined (MSDOS) || defined (MAC_OS8)
164 /* for MSDOS fdpid is really (fd . tempfile) */
165 register Lisp_Object file
;
167 emacs_close (XFASTINT (Fcar (fdpid
)));
168 if (strcmp (SDATA (file
), NULL_DEVICE
) != 0)
169 unlink (SDATA (file
));
170 #else /* not MSDOS and not MAC_OS8 */
171 register int pid
= XFASTINT (Fcdr (fdpid
));
173 if (call_process_exited
)
175 emacs_close (XFASTINT (Fcar (fdpid
)));
179 if (EMACS_KILLPG (pid
, SIGINT
) == 0)
181 int count
= SPECPDL_INDEX ();
182 record_unwind_protect (call_process_kill
, fdpid
);
183 message1 ("Waiting for process to die...(type C-g again to kill it instantly)");
186 wait_for_termination (pid
);
188 specpdl_ptr
= specpdl
+ count
; /* Discard the unwind protect. */
189 message1 ("Waiting for process to die...done");
191 synch_process_alive
= 0;
192 emacs_close (XFASTINT (Fcar (fdpid
)));
193 #endif /* not MSDOS */
197 DEFUN ("call-process", Fcall_process
, Scall_process
, 1, MANY
, 0,
198 doc
: /* Call PROGRAM synchronously in separate process.
199 The remaining arguments are optional.
200 The program's input comes from file INFILE (nil means `/dev/null').
201 Insert output in BUFFER before point; t means current buffer;
202 nil for BUFFER means discard it; 0 means discard and don't wait.
203 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
204 REAL-BUFFER says what to do with standard output, as above,
205 while STDERR-FILE says what to do with standard error in the child.
206 STDERR-FILE may be nil (discard standard error output),
207 t (mix it with ordinary output), or a file name string.
209 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.
210 Remaining arguments are strings passed as command arguments to PROGRAM.
212 If executable PROGRAM can't be found as an executable, `call-process'
213 signals a Lisp error. `call-process' reports errors in execution of
214 the program only through its return and output.
216 If BUFFER is 0, `call-process' returns immediately with value nil.
217 Otherwise it waits for PROGRAM to terminate
218 and returns a numeric exit status or a signal description string.
219 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
221 usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
224 register Lisp_Object
*args
;
226 Lisp_Object infile
, buffer
, current_dir
, path
;
231 #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024)
232 #define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN)
233 char buf
[CALLPROC_BUFFER_SIZE_MAX
];
234 int bufsize
= CALLPROC_BUFFER_SIZE_MIN
;
235 int count
= SPECPDL_INDEX ();
237 register const unsigned char **new_argv
238 = (const unsigned char **) alloca ((max (2, nargs
- 2)) * sizeof (char *));
239 struct buffer
*old
= current_buffer
;
240 /* File to use for stderr in the child.
241 t means use same as standard output. */
242 Lisp_Object error_file
;
243 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
244 char *outf
, *tempfile
;
254 struct coding_system process_coding
; /* coding-system of process output */
255 struct coding_system argument_coding
; /* coding-system of arguments */
256 /* Set to the return value of Ffind_operation_coding_system. */
257 Lisp_Object coding_systems
;
259 /* Qt denotes that Ffind_operation_coding_system is not yet called. */
262 CHECK_STRING (args
[0]);
267 /* Without asynchronous processes we cannot have BUFFER == 0. */
269 && (INTEGERP (CONSP (args
[2]) ? XCAR (args
[2]) : args
[2])))
270 error ("Operating system cannot handle asynchronous subprocesses");
271 #endif /* subprocesses */
273 /* Decide the coding-system for giving arguments. */
275 Lisp_Object val
, *args2
;
278 /* If arguments are supplied, we may have to encode them. */
282 Lisp_Object coding_attrs
;
284 for (i
= 4; i
< nargs
; i
++)
285 CHECK_STRING (args
[i
]);
287 for (i
= 4; i
< nargs
; i
++)
288 if (STRING_MULTIBYTE (args
[i
]))
291 if (!NILP (Vcoding_system_for_write
))
292 val
= Vcoding_system_for_write
;
293 else if (! must_encode
)
297 args2
= (Lisp_Object
*) alloca ((nargs
+ 1) * sizeof *args2
);
298 args2
[0] = Qcall_process
;
299 for (i
= 0; i
< nargs
; i
++) args2
[i
+ 1] = args
[i
];
300 coding_systems
= Ffind_operation_coding_system (nargs
+ 1, args2
);
301 if (CONSP (coding_systems
))
302 val
= XCDR (coding_systems
);
303 else if (CONSP (Vdefault_process_coding_system
))
304 val
= XCDR (Vdefault_process_coding_system
);
308 val
= coding_inherit_eol_type (val
, Qnil
);
309 setup_coding_system (Fcheck_coding_system (val
), &argument_coding
);
310 coding_attrs
= CODING_ID_ATTRS (argument_coding
.id
);
311 if (NILP (CODING_ATTR_ASCII_COMPAT (coding_attrs
)))
313 /* We should not use an ASCII incompatible coding system. */
314 val
= raw_text_coding_system (val
);
315 setup_coding_system (val
, &argument_coding
);
320 if (nargs
>= 2 && ! NILP (args
[1]))
322 infile
= Fexpand_file_name (args
[1], current_buffer
->directory
);
323 CHECK_STRING (infile
);
326 infile
= build_string (NULL_DEVICE
);
332 /* If BUFFER is a list, its meaning is
333 (BUFFER-FOR-STDOUT FILE-FOR-STDERR). */
336 if (CONSP (XCDR (buffer
)))
338 Lisp_Object stderr_file
;
339 stderr_file
= XCAR (XCDR (buffer
));
341 if (NILP (stderr_file
) || EQ (Qt
, stderr_file
))
342 error_file
= stderr_file
;
344 error_file
= Fexpand_file_name (stderr_file
, Qnil
);
347 buffer
= XCAR (buffer
);
350 if (!(EQ (buffer
, Qnil
)
352 || INTEGERP (buffer
)))
354 Lisp_Object spec_buffer
;
355 spec_buffer
= buffer
;
356 buffer
= Fget_buffer_create (buffer
);
357 /* Mention the buffer name for a better error message. */
359 CHECK_BUFFER (spec_buffer
);
360 CHECK_BUFFER (buffer
);
366 /* Make sure that the child will be able to chdir to the current
367 buffer's current directory, or its unhandled equivalent. We
368 can't just have the child check for an error when it does the
369 chdir, since it's in a vfork.
371 We have to GCPRO around this because Fexpand_file_name,
372 Funhandled_file_name_directory, and Ffile_accessible_directory_p
373 might call a file name handling function. The argument list is
374 protected by the caller, so all we really have to worry about is
377 struct gcpro gcpro1
, gcpro2
, gcpro3
, gcpro4
;
379 current_dir
= current_buffer
->directory
;
381 GCPRO4 (infile
, buffer
, current_dir
, error_file
);
384 = expand_and_dir_to_file (Funhandled_file_name_directory (current_dir
),
386 if (NILP (Ffile_accessible_directory_p (current_dir
)))
387 report_file_error ("Setting current directory",
388 Fcons (current_buffer
->directory
, Qnil
));
390 if (STRING_MULTIBYTE (infile
))
391 infile
= ENCODE_FILE (infile
);
392 if (STRING_MULTIBYTE (current_dir
))
393 current_dir
= ENCODE_FILE (current_dir
);
394 if (STRINGP (error_file
) && STRING_MULTIBYTE (error_file
))
395 error_file
= ENCODE_FILE (error_file
);
399 display_p
= INTERACTIVE
&& nargs
>= 4 && !NILP (args
[3]);
401 filefd
= emacs_open (SDATA (infile
), O_RDONLY
, 0);
404 infile
= DECODE_FILE (infile
);
405 report_file_error ("Opening process input file", Fcons (infile
, Qnil
));
407 /* Search for program; barf if not found. */
411 GCPRO1 (current_dir
);
412 openp (Vexec_path
, args
[0], Vexec_suffixes
, &path
, make_number (X_OK
));
417 emacs_close (filefd
);
418 report_file_error ("Searching for program", Fcons (args
[0], Qnil
));
421 /* If program file name starts with /: for quoting a magic name,
423 if (SBYTES (path
) > 2 && SREF (path
, 0) == '/'
424 && SREF (path
, 1) == ':')
425 path
= Fsubstring (path
, make_number (2), Qnil
);
427 new_argv
[0] = SDATA (path
);
431 struct gcpro gcpro1
, gcpro2
, gcpro3
;
433 GCPRO3 (infile
, buffer
, current_dir
);
434 argument_coding
.dst_multibyte
= 0;
435 for (i
= 4; i
< nargs
; i
++)
437 argument_coding
.src_multibyte
= STRING_MULTIBYTE (args
[i
]);
438 if (CODING_REQUIRE_ENCODING (&argument_coding
))
439 /* We must encode this argument. */
440 args
[i
] = encode_coding_string (&argument_coding
, args
[i
], 1);
441 new_argv
[i
- 3] = SDATA (args
[i
]);
444 new_argv
[nargs
- 3] = 0;
449 #ifdef MSDOS /* MW, July 1993 */
450 if ((outf
= egetenv ("TMPDIR")))
451 strcpy (tempfile
= alloca (strlen (outf
) + 20), outf
);
454 tempfile
= alloca (20);
457 dostounix_filename (tempfile
);
458 if (*tempfile
== '\0' || tempfile
[strlen (tempfile
) - 1] != '/')
459 strcat (tempfile
, "/");
460 strcat (tempfile
, "detmp.XXX");
463 outfilefd
= creat (tempfile
, S_IREAD
| S_IWRITE
);
466 emacs_close (filefd
);
467 report_file_error ("Opening process output file",
468 Fcons (build_string (tempfile
), Qnil
));
475 /* Since we don't have pipes on the Mac, create a temporary file to
476 hold the output of the subprocess. */
477 tempfile
= (char *) alloca (SBYTES (Vtemp_file_name_pattern
) + 1);
478 bcopy (SDATA (Vtemp_file_name_pattern
), tempfile
,
479 SBYTES (Vtemp_file_name_pattern
) + 1);
483 outfilefd
= creat (tempfile
, S_IREAD
| S_IWRITE
);
487 report_file_error ("Opening process output file",
488 Fcons (build_string (tempfile
), Qnil
));
494 if (INTEGERP (buffer
))
495 fd
[1] = emacs_open (NULL_DEVICE
, O_WRONLY
, 0), fd
[0] = -1;
503 emacs_close (filefd
);
504 report_file_error ("Creating process pipe", Qnil
);
509 /* Replaced by close_process_descs */
510 set_exclusive_use (fd
[0]);
515 /* child_setup must clobber environ in systems with true vfork.
516 Protect it from permanent change. */
517 register char **save_environ
= environ
;
518 register int fd1
= fd
[1];
521 #if 0 /* Some systems don't have sigblock. */
522 mask
= sigblock (sigmask (SIGCHLD
));
525 /* Record that we're about to create a synchronous process. */
526 synch_process_alive
= 1;
528 /* These vars record information from process termination.
529 Clear them now before process can possibly terminate,
530 to avoid timing error if process terminates soon. */
531 synch_process_death
= 0;
532 synch_process_retcode
= 0;
533 synch_process_termsig
= 0;
535 if (NILP (error_file
))
536 fd_error
= emacs_open (NULL_DEVICE
, O_WRONLY
, 0);
537 else if (STRINGP (error_file
))
540 fd_error
= emacs_open (SDATA (error_file
),
541 O_WRONLY
| O_TRUNC
| O_CREAT
| O_TEXT
,
543 #else /* not DOS_NT */
544 fd_error
= creat (SDATA (error_file
), 0666);
545 #endif /* not DOS_NT */
550 emacs_close (filefd
);
558 if (NILP (error_file
))
559 error_file
= build_string (NULL_DEVICE
);
560 else if (STRINGP (error_file
))
561 error_file
= DECODE_FILE (error_file
);
562 report_file_error ("Cannot redirect stderr", Fcons (error_file
, Qnil
));
567 /* Call run_mac_command in sysdep.c here directly instead of doing
568 a child_setup as for MSDOS and other platforms. Note that this
569 code does not handle passing the environment to the synchronous
571 char *infn
, *outfn
, *errfn
, *currdn
;
573 /* close these files so subprocess can write to them */
575 if (fd_error
!= outfilefd
)
577 fd1
= -1; /* No harm in closing that one! */
579 infn
= SDATA (infile
);
581 if (NILP (error_file
))
583 else if (EQ (Qt
, error_file
))
586 errfn
= SDATA (error_file
);
587 currdn
= SDATA (current_dir
);
588 pid
= run_mac_command (new_argv
, currdn
, infn
, outfn
, errfn
);
590 /* Record that the synchronous process exited and note its
591 termination status. */
592 synch_process_alive
= 0;
593 synch_process_retcode
= pid
;
594 if (synch_process_retcode
< 0) /* means it couldn't be exec'ed */
596 synchronize_system_messages_locale ();
597 synch_process_death
= strerror (errno
);
600 /* Since CRLF is converted to LF within `decode_coding', we can
601 always open a file with binary mode. */
602 fd
[0] = open (tempfile
, O_BINARY
);
607 report_file_error ("Cannot re-open temporary file", Qnil
);
610 #else /* not MAC_OS8 */
611 #ifdef MSDOS /* MW, July 1993 */
612 /* Note that on MSDOS `child_setup' actually returns the child process
613 exit status, not its PID, so we assign it to `synch_process_retcode'
615 pid
= child_setup (filefd
, outfilefd
, fd_error
, (char **) new_argv
,
618 /* Record that the synchronous process exited and note its
619 termination status. */
620 synch_process_alive
= 0;
621 synch_process_retcode
= pid
;
622 if (synch_process_retcode
< 0) /* means it couldn't be exec'ed */
624 synchronize_system_messages_locale ();
625 synch_process_death
= strerror (errno
);
628 emacs_close (outfilefd
);
629 if (fd_error
!= outfilefd
)
630 emacs_close (fd_error
);
631 fd1
= -1; /* No harm in closing that one! */
632 /* Since CRLF is converted to LF within `decode_coding', we can
633 always open a file with binary mode. */
634 fd
[0] = emacs_open (tempfile
, O_RDONLY
| O_BINARY
, 0);
638 emacs_close (filefd
);
639 report_file_error ("Cannot re-open temporary file", Qnil
);
641 #else /* not MSDOS */
643 pid
= child_setup (filefd
, fd1
, fd_error
, (char **) new_argv
,
645 #else /* not WINDOWSNT */
657 #if defined (USG) && !defined (BSD_PGRPS)
662 child_setup (filefd
, fd1
, fd_error
, (char **) new_argv
,
667 #endif /* not WINDOWSNT */
669 /* The MSDOS case did this already. */
671 emacs_close (fd_error
);
672 #endif /* not MSDOS */
673 #endif /* not MAC_OS8 */
675 environ
= save_environ
;
677 /* Close most of our fd's, but not fd[0]
678 since we will use that to read input from. */
679 emacs_close (filefd
);
680 if (fd1
>= 0 && fd1
!= fd_error
)
688 report_file_error ("Doing vfork", Qnil
);
691 if (INTEGERP (buffer
))
696 /* If Emacs has been built with asynchronous subprocess support,
697 we don't need to do this, I think because it will then have
698 the facilities for handling SIGCHLD. */
699 wait_without_blocking ();
700 #endif /* subprocesses */
704 /* Enable sending signal if user quits below. */
705 call_process_exited
= 0;
707 #if defined(MSDOS) || defined(MAC_OS8)
708 /* MSDOS needs different cleanup information. */
709 record_unwind_protect (call_process_cleanup
,
710 Fcons (make_number (fd
[0]), build_string (tempfile
)));
712 record_unwind_protect (call_process_cleanup
,
713 Fcons (make_number (fd
[0]), make_number (pid
)));
714 #endif /* not MSDOS and not MAC_OS8 */
717 if (BUFFERP (buffer
))
718 Fset_buffer (buffer
);
722 /* If BUFFER is nil, we must read process output once and then
723 discard it, so setup coding system but with nil. */
724 setup_coding_system (Qnil
, &process_coding
);
728 Lisp_Object val
, *args2
;
731 if (!NILP (Vcoding_system_for_read
))
732 val
= Vcoding_system_for_read
;
735 if (EQ (coding_systems
, Qt
))
739 args2
= (Lisp_Object
*) alloca ((nargs
+ 1) * sizeof *args2
);
740 args2
[0] = Qcall_process
;
741 for (i
= 0; i
< nargs
; i
++) args2
[i
+ 1] = args
[i
];
743 = Ffind_operation_coding_system (nargs
+ 1, args2
);
745 if (CONSP (coding_systems
))
746 val
= XCAR (coding_systems
);
747 else if (CONSP (Vdefault_process_coding_system
))
748 val
= XCAR (Vdefault_process_coding_system
);
752 Fcheck_coding_system (val
);
753 /* In unibyte mode, character code conversion should not take
754 place but EOL conversion should. So, setup raw-text or one
755 of the subsidiary according to the information just setup. */
756 if (NILP (current_buffer
->enable_multibyte_characters
)
758 val
= raw_text_coding_system (val
);
759 setup_coding_system (val
, &process_coding
);
770 int display_on_the_fly
= display_p
;
771 struct coding_system saved_coding
;
773 saved_coding
= process_coding
;
776 /* Repeatedly read until we've filled as much as possible
777 of the buffer size we have. But don't read
778 less than 1024--save that for the next bufferful. */
780 while (nread
< bufsize
- 1024)
782 int this_read
= emacs_read (fd
[0], buf
+ nread
,
790 process_coding
.mode
|= CODING_MODE_LAST_BLOCK
;
795 total_read
+= this_read
;
797 if (display_on_the_fly
)
801 /* Now NREAD is the total amount of data in the buffer. */
806 if (NILP (current_buffer
->enable_multibyte_characters
)
807 && ! CODING_MAY_REQUIRE_DECODING (&process_coding
))
808 insert_1_both (buf
, nread
, nread
, 0, 1, 0);
810 { /* We have to decode the input. */
813 XSETBUFFER (curbuf
, current_buffer
);
814 decode_coding_c_string (&process_coding
, buf
, nread
,
816 if (display_on_the_fly
817 && CODING_REQUIRE_DETECTION (&saved_coding
)
818 && ! CODING_REQUIRE_DETECTION (&process_coding
))
820 /* We have detected some coding system. But,
821 there's a possibility that the detection was
822 done by insufficient data. So, we give up
823 displaying on the fly. */
824 if (process_coding
.produced
> 0)
825 del_range_2 (process_coding
.dst_pos
,
826 process_coding
.dst_pos_byte
,
827 process_coding
.dst_pos
828 + process_coding
.produced_char
,
829 process_coding
.dst_pos_byte
830 + process_coding
.produced
, 0);
831 display_on_the_fly
= 0;
832 process_coding
= saved_coding
;
834 /* This is to make the above condition always
835 fails in the future. */
836 saved_coding
.common_flags
837 &= ~CODING_REQUIRE_DETECTION_MASK
;
841 TEMP_SET_PT_BOTH (PT
+ process_coding
.produced_char
,
842 PT_BYTE
+ process_coding
.produced
);
843 carryover
= process_coding
.carryover_bytes
;
845 /* As CARRYOVER should not be that large, we had
846 better avoid overhead of bcopy. */
847 BCOPY_SHORT (process_coding
.carryover
, buf
,
848 process_coding
.carryover_bytes
);
852 if (process_coding
.mode
& CODING_MODE_LAST_BLOCK
)
855 #if (CALLPROC_BUFFER_SIZE_MIN != CALLPROC_BUFFER_SIZE_MAX)
856 /* Make the buffer bigger as we continue to read more data,
857 but not past CALLPROC_BUFFER_SIZE_MAX. */
858 if (bufsize
< CALLPROC_BUFFER_SIZE_MAX
&& total_read
> 32 * bufsize
)
859 if ((bufsize
*= 2) > CALLPROC_BUFFER_SIZE_MAX
)
860 bufsize
= CALLPROC_BUFFER_SIZE_MAX
;
866 prepare_menu_bars ();
868 redisplay_preserve_echo_area (1);
869 /* This variable might have been set to 0 for code
870 detection. In that case, we set it back to 1 because
871 we should have already detected a coding system. */
872 display_on_the_fly
= 1;
879 Vlast_coding_system_used
= CODING_ID_NAME (process_coding
.id
);
880 /* If the caller required, let the buffer inherit the
881 coding-system used to decode the process output. */
882 if (inherit_process_coding_system
)
883 call1 (intern ("after-insert-file-set-buffer-file-coding-system"),
884 make_number (total_read
));
887 /* Wait for it to terminate, unless it already has. */
888 wait_for_termination (pid
);
892 set_buffer_internal (old
);
894 /* Don't kill any children that the subprocess may have left behind
896 call_process_exited
= 1;
898 unbind_to (count
, Qnil
);
900 if (synch_process_termsig
)
904 synchronize_system_messages_locale ();
905 signame
= strsignal (synch_process_termsig
);
910 synch_process_death
= signame
;
913 if (synch_process_death
)
914 return code_convert_string_norecord (build_string (synch_process_death
),
915 Vlocale_coding_system
, 0);
916 return make_number (synch_process_retcode
);
921 delete_temp_file (name
)
924 /* Suppress jka-compr handling, etc. */
925 int count
= SPECPDL_INDEX ();
926 specbind (intern ("file-name-handler-alist"), Qnil
);
927 internal_delete_file (name
);
928 unbind_to (count
, Qnil
);
932 DEFUN ("call-process-region", Fcall_process_region
, Scall_process_region
,
934 doc
: /* Send text from START to END to a synchronous process running PROGRAM.
935 The remaining arguments are optional.
936 Delete the text if fourth arg DELETE is non-nil.
938 Insert output in BUFFER before point; t means current buffer;
939 nil for BUFFER means discard it; 0 means discard and don't wait.
940 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
941 REAL-BUFFER says what to do with standard output, as above,
942 while STDERR-FILE says what to do with standard error in the child.
943 STDERR-FILE may be nil (discard standard error output),
944 t (mix it with ordinary output), or a file name string.
946 Sixth arg DISPLAY non-nil means redisplay buffer as output is inserted.
947 Remaining args are passed to PROGRAM at startup as command args.
949 If BUFFER is 0, `call-process-region' returns immediately with value nil.
950 Otherwise it waits for PROGRAM to terminate
951 and returns a numeric exit status or a signal description string.
952 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
954 usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS) */)
957 register Lisp_Object
*args
;
960 Lisp_Object filename_string
;
961 register Lisp_Object start
, end
;
962 int count
= SPECPDL_INDEX ();
963 /* Qt denotes we have not yet called Ffind_operation_coding_system. */
964 Lisp_Object coding_systems
;
965 Lisp_Object val
, *args2
;
971 if ((outf
= egetenv ("TMPDIR"))
972 || (outf
= egetenv ("TMP"))
973 || (outf
= egetenv ("TEMP")))
974 strcpy (tempfile
= alloca (strlen (outf
) + 20), outf
);
977 tempfile
= alloca (20);
980 if (!IS_DIRECTORY_SEP (tempfile
[strlen (tempfile
) - 1]))
981 strcat (tempfile
, "/");
982 if ('/' == DIRECTORY_SEP
)
983 dostounix_filename (tempfile
);
985 unixtodos_filename (tempfile
);
987 strcat (tempfile
, "emXXXXXX");
989 strcat (tempfile
, "detmp.XXX");
991 #else /* not DOS_NT */
992 char *tempfile
= (char *) alloca (SBYTES (Vtemp_file_name_pattern
) + 1);
993 bcopy (SDATA (Vtemp_file_name_pattern
), tempfile
,
994 SBYTES (Vtemp_file_name_pattern
) + 1);
995 #endif /* not DOS_NT */
1004 fd
= mkstemp (tempfile
);
1007 report_file_error ("Failed to open temporary file",
1008 Fcons (Vtemp_file_name_pattern
, Qnil
));
1016 filename_string
= build_string (tempfile
);
1017 GCPRO1 (filename_string
);
1020 /* Decide coding-system of the contents of the temporary file. */
1021 if (!NILP (Vcoding_system_for_write
))
1022 val
= Vcoding_system_for_write
;
1023 else if (NILP (current_buffer
->enable_multibyte_characters
))
1027 args2
= (Lisp_Object
*) alloca ((nargs
+ 1) * sizeof *args2
);
1028 args2
[0] = Qcall_process_region
;
1029 for (i
= 0; i
< nargs
; i
++) args2
[i
+ 1] = args
[i
];
1030 coding_systems
= Ffind_operation_coding_system (nargs
+ 1, args2
);
1031 if (CONSP (coding_systems
))
1032 val
= XCDR (coding_systems
);
1033 else if (CONSP (Vdefault_process_coding_system
))
1034 val
= XCDR (Vdefault_process_coding_system
);
1040 int count1
= SPECPDL_INDEX ();
1042 specbind (intern ("coding-system-for-write"), val
);
1043 /* POSIX lets mk[s]temp use "."; don't invoke jka-compr if we
1044 happen to get a ".Z" suffix. */
1045 specbind (intern ("file-name-handler-alist"), Qnil
);
1046 Fwrite_region (start
, end
, filename_string
, Qnil
, Qlambda
, Qnil
, Qnil
);
1048 unbind_to (count1
, Qnil
);
1051 /* Note that Fcall_process takes care of binding
1052 coding-system-for-read. */
1054 record_unwind_protect (delete_temp_file
, filename_string
);
1056 if (nargs
> 3 && !NILP (args
[3]))
1057 Fdelete_region (start
, end
);
1069 args
[1] = filename_string
;
1071 RETURN_UNGCPRO (unbind_to (count
, Fcall_process (nargs
, args
)));
1074 #ifndef VMS /* VMS version is in vmsproc.c. */
1076 static int relocate_fd ();
1079 add_env (char **env
, char **new_env
, char *string
)
1086 /* See if this string duplicates any string already in the env.
1087 If so, don't put it in.
1088 When an env var has multiple definitions,
1089 we keep the definition that comes first in process-environment. */
1090 for (ep
= env
; ok
&& ep
!= new_env
; ep
++)
1092 char *p
= *ep
, *q
= string
;
1098 /* The string is a lone variable name; keep it for now, we
1099 will remove it later. It is a placeholder for a
1100 variable that is not to be included in the environment. */
1108 *new_env
++ = string
;
1112 /* This is the last thing run in a newly forked inferior
1113 either synchronous or asynchronous.
1114 Copy descriptors IN, OUT and ERR as descriptors 0, 1 and 2.
1115 Initialize inferior's priority, pgrp, connected dir and environment.
1116 then exec another program based on new_argv.
1118 This function may change environ for the superior process.
1119 Therefore, the superior process must save and restore the value
1120 of environ around the vfork and the call to this function.
1122 SET_PGRP is nonzero if we should put the subprocess into a separate
1125 CURRENT_DIR is an elisp string giving the path of the current
1126 directory the subprocess should have. Since we can't really signal
1127 a decent error from within the child, this should be verified as an
1128 executable directory by the parent. */
1131 child_setup (in
, out
, err
, new_argv
, set_pgrp
, current_dir
)
1133 register char **new_argv
;
1135 Lisp_Object current_dir
;
1142 #endif /* WINDOWSNT */
1144 int pid
= getpid ();
1146 #ifdef SET_EMACS_PRIORITY
1148 extern EMACS_INT emacs_priority
;
1150 if (emacs_priority
< 0)
1151 nice (- emacs_priority
);
1156 /* Close Emacs's descriptors that this process should not have. */
1157 close_process_descs ();
1159 /* DOS_NT isn't in a vfork, so if we are in the middle of load-file,
1160 we will lose if we call close_load_descs here. */
1162 close_load_descs ();
1165 /* Note that use of alloca is always safe here. It's obvious for systems
1166 that do not have true vfork or that have true (stack) alloca.
1167 If using vfork and C_ALLOCA (when Emacs used to include
1168 src/alloca.c) it is safe because that changes the superior's
1169 static variables as if the superior had done alloca and will be
1170 cleaned up in the usual way. */
1172 register char *temp
;
1175 i
= SBYTES (current_dir
);
1177 /* MSDOS must have all environment variables malloc'ed, because
1178 low-level libc functions that launch subsidiary processes rely
1180 pwd_var
= (char *) xmalloc (i
+ 6);
1182 pwd_var
= (char *) alloca (i
+ 6);
1185 bcopy ("PWD=", pwd_var
, 4);
1186 bcopy (SDATA (current_dir
), temp
, i
);
1187 if (!IS_DIRECTORY_SEP (temp
[i
- 1])) temp
[i
++] = DIRECTORY_SEP
;
1191 /* We can't signal an Elisp error here; we're in a vfork. Since
1192 the callers check the current directory before forking, this
1193 should only return an error if the directory's permissions
1194 are changed between the check and this chdir, but we should
1196 if (chdir (temp
) < 0)
1201 /* Get past the drive letter, so that d:/ is left alone. */
1202 if (i
> 2 && IS_DEVICE_SEP (temp
[1]) && IS_DIRECTORY_SEP (temp
[2]))
1209 /* Strip trailing slashes for PWD, but leave "/" and "//" alone. */
1210 while (i
> 2 && IS_DIRECTORY_SEP (temp
[i
- 1]))
1214 /* Set `env' to a vector of the strings in the environment. */
1216 register Lisp_Object tem
;
1217 register char **new_env
;
1219 register int new_length
;
1220 Lisp_Object display
= Qnil
;
1224 for (tem
= Vprocess_environment
;
1225 CONSP (tem
) && STRINGP (XCAR (tem
));
1228 if (strncmp (SDATA (XCAR (tem
)), "DISPLAY", 7) == 0
1229 && (SDATA (XCAR (tem
)) [7] == '\0'
1230 || SDATA (XCAR (tem
)) [7] == '='))
1231 /* DISPLAY is specified in process-environment. */
1236 /* If not provided yet, use the frame's DISPLAY. */
1239 Lisp_Object tmp
= Fframe_parameter (selected_frame
, Qdisplay
);
1240 if (!STRINGP (tmp
) && CONSP (Vinitial_environment
))
1241 /* If still not found, Look for DISPLAY in Vinitial_environment. */
1242 tmp
= Fgetenv_internal (build_string ("DISPLAY"),
1243 Vinitial_environment
);
1251 /* new_length + 2 to include PWD and terminating 0. */
1252 env
= new_env
= (char **) alloca ((new_length
+ 2) * sizeof (char *));
1253 /* If we have a PWD envvar, pass one down,
1254 but with corrected value. */
1255 if (egetenv ("PWD"))
1256 *new_env
++ = pwd_var
;
1258 if (STRINGP (display
))
1260 int vlen
= strlen ("DISPLAY=") + strlen (SDATA (display
)) + 1;
1261 char *vdata
= (char *) alloca (vlen
);
1262 strcpy (vdata
, "DISPLAY=");
1263 strcat (vdata
, SDATA (display
));
1264 new_env
= add_env (env
, new_env
, vdata
);
1268 for (tem
= Vprocess_environment
;
1269 CONSP (tem
) && STRINGP (XCAR (tem
));
1271 new_env
= add_env (env
, new_env
, SDATA (XCAR (tem
)));
1275 /* Remove variable names without values. */
1279 while (*q
!= 0 && strchr (*q
, '=') == NULL
)
1289 prepare_standard_handles (in
, out
, err
, handles
);
1290 set_process_dir (SDATA (current_dir
));
1291 #else /* not WINDOWSNT */
1292 /* Make sure that in, out, and err are not actually already in
1293 descriptors zero, one, or two; this could happen if Emacs is
1294 started with its standard in, out, or error closed, as might
1297 int oin
= in
, oout
= out
;
1299 /* We have to avoid relocating the same descriptor twice! */
1301 in
= relocate_fd (in
, 3);
1306 out
= relocate_fd (out
, 3);
1310 else if (err
== oout
)
1313 err
= relocate_fd (err
, 3);
1327 #endif /* not MSDOS */
1328 #endif /* not WINDOWSNT */
1330 #if defined(USG) && !defined(BSD_PGRPS)
1331 #ifndef SETPGRP_RELEASES_CTTY
1332 setpgrp (); /* No arguments but equivalent in this case */
1337 /* setpgrp_of_tty is incorrect here; it uses input_fd. */
1338 EMACS_SET_TTY_PGRP (0, &pid
);
1341 pid
= run_msdos_command (new_argv
, pwd_var
+ 4, in
, out
, err
, env
);
1344 /* An error occurred while trying to run the subprocess. */
1345 report_file_error ("Spawning child process", Qnil
);
1347 #else /* not MSDOS */
1349 /* Spawn the child. (See ntproc.c:Spawnve). */
1350 cpid
= spawnve (_P_NOWAIT
, new_argv
[0], new_argv
, env
);
1351 reset_standard_handles (in
, out
, err
, handles
);
1353 /* An error occurred while trying to spawn the process. */
1354 report_file_error ("Spawning child process", Qnil
);
1356 #else /* not WINDOWSNT */
1357 /* execvp does not accept an environment arg so the only way
1358 to pass this environment is to set environ. Our caller
1359 is responsible for restoring the ambient value of environ. */
1361 execvp (new_argv
[0], new_argv
);
1363 emacs_write (1, "Can't exec program: ", 20);
1364 emacs_write (1, new_argv
[0], strlen (new_argv
[0]));
1365 emacs_write (1, "\n", 1);
1367 #endif /* not WINDOWSNT */
1368 #endif /* not MSDOS */
1371 /* Move the file descriptor FD so that its number is not less than MINFD.
1372 If the file descriptor is moved at all, the original is freed. */
1374 relocate_fd (fd
, minfd
)
1384 char *message1
= "Error while setting up child: ";
1385 char *errmessage
= strerror (errno
);
1386 char *message2
= "\n";
1387 emacs_write (2, message1
, strlen (message1
));
1388 emacs_write (2, errmessage
, strlen (errmessage
));
1389 emacs_write (2, message2
, strlen (message2
));
1392 /* Note that we hold the original FD open while we recurse,
1393 to guarantee we'll get a new FD if we need it. */
1394 new = relocate_fd (new, minfd
);
1401 getenv_internal_1 (var
, varlen
, value
, valuelen
, env
)
1408 for (; CONSP (env
); env
= XCDR (env
))
1410 Lisp_Object entry
= XCAR (env
);
1412 && SBYTES (entry
) >= varlen
1414 /* NT environment variables are case insensitive. */
1415 && ! strnicmp (SDATA (entry
), var
, varlen
)
1416 #else /* not WINDOWSNT */
1417 && ! bcmp (SDATA (entry
), var
, varlen
)
1418 #endif /* not WINDOWSNT */
1421 if (SBYTES (entry
) > varlen
&& SREF (entry
, varlen
) == '=')
1423 *value
= (char *) SDATA (entry
) + (varlen
+ 1);
1424 *valuelen
= SBYTES (entry
) - (varlen
+ 1);
1427 else if (SBYTES (entry
) == varlen
)
1429 /* Lone variable names in Vprocess_environment mean that
1430 variable should be removed from the environment. */
1440 getenv_internal (var
, varlen
, value
, valuelen
, frame
)
1447 /* Try to find VAR in Vprocess_environment first. */
1448 if (getenv_internal_1 (var
, varlen
, value
, valuelen
,
1449 Vprocess_environment
))
1450 return *value
? 1 : 0;
1452 /* For DISPLAY try to get the values from the frame or the initial env. */
1453 if (strcmp (var
, "DISPLAY") == 0)
1456 = Fframe_parameter (NILP (frame
) ? selected_frame
: frame
, Qdisplay
);
1457 if (STRINGP (display
))
1459 *value
= (char *) SDATA (display
);
1460 *valuelen
= SBYTES (display
);
1463 /* If still not found, Look for DISPLAY in Vinitial_environment. */
1464 if (getenv_internal_1 (var
, varlen
, value
, valuelen
,
1465 Vinitial_environment
))
1466 return *value
? 1 : 0;
1472 DEFUN ("getenv-internal", Fgetenv_internal
, Sgetenv_internal
, 1, 2, 0,
1473 doc
: /* Get the value of environment variable VARIABLE.
1474 VARIABLE should be a string. Value is nil if VARIABLE is undefined in
1475 the environment. Otherwise, value is a string.
1477 This function searches `process-environment' for VARIABLE. If it is
1478 not found there, then it continues the search in the environment list
1479 of the selected frame.
1481 If optional parameter ENV is a list, then search this list instead of
1482 `process-environment', and return t when encountering a negative entry.
1484 If it is a frame, then this function will ignore `process-environment' and
1485 will simply look up the variable in that frame's environment. */)
1487 Lisp_Object variable
, env
;
1492 CHECK_STRING (variable
);
1495 if (getenv_internal_1 (SDATA (variable
), SBYTES (variable
),
1496 &value
, &valuelen
, env
))
1497 return value
? make_string (value
, valuelen
) : Qt
;
1501 else if (getenv_internal (SDATA (variable
), SBYTES (variable
),
1502 &value
, &valuelen
, env
))
1503 return make_string (value
, valuelen
);
1508 /* A version of getenv that consults the Lisp environment lists,
1509 easily callable from C. */
1517 if (getenv_internal (var
, strlen (var
), &value
, &valuelen
, Qnil
))
1523 #endif /* not VMS */
1525 /* This is run before init_cmdargs. */
1530 char *data_dir
= egetenv ("EMACSDATA");
1531 char *doc_dir
= egetenv ("EMACSDOC");
1534 = Ffile_name_as_directory (build_string (data_dir
? data_dir
1537 = Ffile_name_as_directory (build_string (doc_dir
? doc_dir
1540 /* Check the EMACSPATH environment variable, defaulting to the
1541 PATH_EXEC path from epaths.h. */
1542 Vexec_path
= decode_env_path ("EMACSPATH", PATH_EXEC
);
1543 Vexec_directory
= Ffile_name_as_directory (Fcar (Vexec_path
));
1544 Vexec_path
= nconc2 (decode_env_path ("PATH", ""), Vexec_path
);
1547 /* This is run after init_cmdargs, when Vinstallation_directory is valid. */
1552 char *data_dir
= egetenv ("EMACSDATA");
1555 Lisp_Object tempdir
;
1557 if (!NILP (Vinstallation_directory
))
1559 /* Add to the path the lib-src subdir of the installation dir. */
1561 tem
= Fexpand_file_name (build_string ("lib-src"),
1562 Vinstallation_directory
);
1564 /* MSDOS uses wrapped binaries, so don't do this. */
1565 if (NILP (Fmember (tem
, Vexec_path
)))
1567 Vexec_path
= decode_env_path ("EMACSPATH", PATH_EXEC
);
1568 Vexec_path
= Fcons (tem
, Vexec_path
);
1569 Vexec_path
= nconc2 (decode_env_path ("PATH", ""), Vexec_path
);
1572 Vexec_directory
= Ffile_name_as_directory (tem
);
1573 #endif /* not DOS_NT */
1575 /* Maybe use ../etc as well as ../lib-src. */
1578 tem
= Fexpand_file_name (build_string ("etc"),
1579 Vinstallation_directory
);
1580 Vdoc_directory
= Ffile_name_as_directory (tem
);
1584 /* Look for the files that should be in etc. We don't use
1585 Vinstallation_directory, because these files are never installed
1586 near the executable, and they are never in the build
1587 directory when that's different from the source directory.
1589 Instead, if these files are not in the nominal place, we try the
1590 source directory. */
1593 Lisp_Object tem
, tem1
, srcdir
;
1595 srcdir
= Fexpand_file_name (build_string ("../src/"),
1596 build_string (PATH_DUMPLOADSEARCH
));
1597 tem
= Fexpand_file_name (build_string ("GNU"), Vdata_directory
);
1598 tem1
= Ffile_exists_p (tem
);
1599 if (!NILP (Fequal (srcdir
, Vinvocation_directory
)) || NILP (tem1
))
1602 newdir
= Fexpand_file_name (build_string ("../etc/"),
1603 build_string (PATH_DUMPLOADSEARCH
));
1604 tem
= Fexpand_file_name (build_string ("GNU"), newdir
);
1605 tem1
= Ffile_exists_p (tem
);
1607 Vdata_directory
= newdir
;
1615 tempdir
= Fdirectory_file_name (Vexec_directory
);
1616 if (access (SDATA (tempdir
), 0) < 0)
1617 dir_warning ("Warning: arch-dependent data dir (%s) does not exist.\n",
1621 tempdir
= Fdirectory_file_name (Vdata_directory
);
1622 if (access (SDATA (tempdir
), 0) < 0)
1623 dir_warning ("Warning: arch-independent data dir (%s) does not exist.\n",
1627 Vshell_file_name
= build_string ("*dcl*");
1629 sh
= (char *) getenv ("SHELL");
1630 Vshell_file_name
= build_string (sh
? sh
: "/bin/sh");
1634 Vtemp_file_name_pattern
= build_string ("tmp:emacsXXXXXX.");
1636 if (getenv ("TMPDIR"))
1638 char *dir
= getenv ("TMPDIR");
1639 Vtemp_file_name_pattern
1640 = Fexpand_file_name (build_string ("emacsXXXXXX"),
1641 build_string (dir
));
1644 Vtemp_file_name_pattern
= build_string ("/tmp/emacsXXXXXX");
1648 Vshared_game_score_directory
= Qnil
;
1650 Vshared_game_score_directory
= build_string (PATH_GAME
);
1651 if (NILP (Ffile_directory_p (Vshared_game_score_directory
)))
1652 Vshared_game_score_directory
= Qnil
;
1657 set_initial_environment ()
1659 register char **envp
;
1664 for (envp
= environ
; *envp
; envp
++)
1665 Vprocess_environment
= Fcons (build_string (*envp
),
1666 Vprocess_environment
);
1667 /* Ideally, the `copy' shouldn't be necessary, but it seems it's frequent
1668 to use `delete' and friends on process-environment. */
1669 Vinitial_environment
= Fcopy_sequence (Vprocess_environment
);
1677 Qbuffer_file_type
= intern ("buffer-file-type");
1678 staticpro (&Qbuffer_file_type
);
1681 DEFVAR_LISP ("shell-file-name", &Vshell_file_name
,
1682 doc
: /* *File name to load inferior shells from.
1683 Initialized from the SHELL environment variable, or to a system-dependent
1684 default if SHELL is not set. */);
1686 DEFVAR_LISP ("exec-path", &Vexec_path
,
1687 doc
: /* *List of directories to search programs to run in subprocesses.
1688 Each element is a string (directory name) or nil (try default directory). */);
1690 DEFVAR_LISP ("exec-suffixes", &Vexec_suffixes
,
1691 doc
: /* *List of suffixes to try to find executable file names.
1692 Each element is a string. */);
1693 Vexec_suffixes
= Qnil
;
1695 DEFVAR_LISP ("exec-directory", &Vexec_directory
,
1696 doc
: /* Directory for executables for Emacs to invoke.
1697 More generally, this includes any architecture-dependent files
1698 that are built and installed from the Emacs distribution. */);
1700 DEFVAR_LISP ("data-directory", &Vdata_directory
,
1701 doc
: /* Directory of machine-independent files that come with GNU Emacs.
1702 These are files intended for Emacs to use while it runs. */);
1704 DEFVAR_LISP ("doc-directory", &Vdoc_directory
,
1705 doc
: /* Directory containing the DOC file that comes with GNU Emacs.
1706 This is usually the same as `data-directory'. */);
1708 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory
,
1709 doc
: /* For internal use by the build procedure only.
1710 This is the name of the directory in which the build procedure installed
1711 Emacs's info files; the default value for `Info-default-directory-list'
1713 Vconfigure_info_directory
= build_string (PATH_INFO
);
1715 DEFVAR_LISP ("shared-game-score-directory", &Vshared_game_score_directory
,
1716 doc
: /* Directory of score files for games which come with GNU Emacs.
1717 If this variable is nil, then Emacs is unable to use a shared directory. */);
1719 Vshared_game_score_directory
= Qnil
;
1721 Vshared_game_score_directory
= build_string (PATH_GAME
);
1724 DEFVAR_LISP ("temp-file-name-pattern", &Vtemp_file_name_pattern
,
1725 doc
: /* Pattern for making names for temporary files.
1726 This is used by `call-process-region'. */);
1727 /* This variable is initialized in init_callproc. */
1729 DEFVAR_LISP ("initial-environment", &Vinitial_environment
,
1730 doc
: /* List of environment variables inherited from the parent process.
1731 Each element should be a string of the form ENVVARNAME=VALUE.
1732 The elements must normally be decoded (using `locale-coding-system') for use. */);
1733 Vinitial_environment
= Qnil
;
1735 DEFVAR_LISP ("process-environment", &Vprocess_environment
,
1736 doc
: /* List of overridden environment variables for subprocesses to inherit.
1737 Each element should be a string of the form ENVVARNAME=VALUE.
1739 Entries in this list take precedence to those in the frame-local
1740 environments. Therefore, let-binding `process-environment' is an easy
1741 way to temporarily change the value of an environment variable,
1742 irrespective of where it comes from. To use `process-environment' to
1743 remove an environment variable, include only its name in the list,
1746 This variable is set to nil when Emacs starts.
1748 If multiple entries define the same variable, the first one always
1751 Non-ASCII characters are encoded according to the initial value of
1752 `locale-coding-system', i.e. the elements must normally be decoded for
1755 See `setenv' and `getenv'. */);
1756 Vprocess_environment
= Qnil
;
1759 defsubr (&Scall_process
);
1760 defsubr (&Sgetenv_internal
);
1762 defsubr (&Scall_process_region
);
1765 /* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95
1766 (do not change this comment) */