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>
82 #include "composite.h"
85 #include "syssignal.h"
87 #include "blockinput.h"
94 extern noshare
char **environ
;
97 extern char **environ
;
102 #if !defined (USG) || defined (BSD_PGRPS)
104 #define setpgrp setpgid
108 Lisp_Object Vexec_path
, Vexec_directory
, Vexec_suffixes
;
109 Lisp_Object Vdata_directory
, Vdoc_directory
;
110 Lisp_Object Vconfigure_info_directory
, Vshared_game_score_directory
;
111 Lisp_Object Vtemp_file_name_pattern
;
113 Lisp_Object Vshell_file_name
;
115 Lisp_Object Vprocess_environment
;
118 Lisp_Object Qbuffer_file_type
;
121 /* True if we are about to fork off a synchronous process or if we
122 are waiting for it. */
123 int synch_process_alive
;
125 /* Nonzero => this is a string explaining death of synchronous subprocess. */
126 char *synch_process_death
;
128 /* Nonzero => this is the signal number that terminated the subprocess. */
129 int synch_process_termsig
;
131 /* If synch_process_death is zero,
132 this is exit code of synchronous subprocess. */
133 int synch_process_retcode
;
135 /* Clean up when exiting Fcall_process.
136 On MSDOS, delete the temporary file on any kind of termination.
137 On Unix, kill the process and any children on termination by signal. */
139 /* Nonzero if this is termination due to exit. */
140 static int call_process_exited
;
142 #ifndef VMS /* VMS version is in vmsproc.c. */
145 call_process_kill (fdpid
)
148 emacs_close (XFASTINT (Fcar (fdpid
)));
149 EMACS_KILLPG (XFASTINT (Fcdr (fdpid
)), SIGKILL
);
150 synch_process_alive
= 0;
155 call_process_cleanup (fdpid
)
158 #if defined (MSDOS) || defined (MAC_OS8)
159 /* for MSDOS fdpid is really (fd . tempfile) */
160 register Lisp_Object file
;
162 emacs_close (XFASTINT (Fcar (fdpid
)));
163 if (strcmp (SDATA (file
), NULL_DEVICE
) != 0)
164 unlink (SDATA (file
));
165 #else /* not MSDOS and not MAC_OS8 */
166 register int pid
= XFASTINT (Fcdr (fdpid
));
168 if (call_process_exited
)
170 emacs_close (XFASTINT (Fcar (fdpid
)));
174 if (EMACS_KILLPG (pid
, SIGINT
) == 0)
176 int count
= SPECPDL_INDEX ();
177 record_unwind_protect (call_process_kill
, fdpid
);
178 message1 ("Waiting for process to die...(type C-g again to kill it instantly)");
181 wait_for_termination (pid
);
183 specpdl_ptr
= specpdl
+ count
; /* Discard the unwind protect. */
184 message1 ("Waiting for process to die...done");
186 synch_process_alive
= 0;
187 emacs_close (XFASTINT (Fcar (fdpid
)));
188 #endif /* not MSDOS */
192 DEFUN ("call-process", Fcall_process
, Scall_process
, 1, MANY
, 0,
193 doc
: /* Call PROGRAM synchronously in separate process.
194 The remaining arguments are optional.
195 The program's input comes from file INFILE (nil means `/dev/null').
196 Insert output in BUFFER before point; t means current buffer;
197 nil for BUFFER means discard it; 0 means discard and don't wait.
198 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
199 REAL-BUFFER says what to do with standard output, as above,
200 while STDERR-FILE says what to do with standard error in the child.
201 STDERR-FILE may be nil (discard standard error output),
202 t (mix it with ordinary output), or a file name string.
204 Fourth arg DISPLAY non-nil means redisplay buffer as output is inserted.
205 Remaining arguments are strings passed as command arguments to PROGRAM.
207 If executable PROGRAM can't be found as an executable, `call-process'
208 signals a Lisp error. `call-process' reports errors in execution of
209 the program only through its return and output.
211 If BUFFER is 0, `call-process' returns immediately with value nil.
212 Otherwise it waits for PROGRAM to terminate
213 and returns a numeric exit status or a signal description string.
214 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
216 usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
219 register Lisp_Object
*args
;
221 Lisp_Object infile
, buffer
, current_dir
, path
;
226 #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024)
227 #define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN)
228 char buf
[CALLPROC_BUFFER_SIZE_MAX
];
229 int bufsize
= CALLPROC_BUFFER_SIZE_MIN
;
230 int count
= SPECPDL_INDEX ();
232 register const unsigned char **new_argv
233 = (const unsigned char **) alloca ((max (2, nargs
- 2)) * sizeof (char *));
234 struct buffer
*old
= current_buffer
;
235 /* File to use for stderr in the child.
236 t means use same as standard output. */
237 Lisp_Object error_file
;
238 #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
239 char *outf
, *tempfile
;
249 struct coding_system process_coding
; /* coding-system of process output */
250 struct coding_system argument_coding
; /* coding-system of arguments */
251 /* Set to the return value of Ffind_operation_coding_system. */
252 Lisp_Object coding_systems
;
254 /* Qt denotes that Ffind_operation_coding_system is not yet called. */
257 CHECK_STRING (args
[0]);
262 /* Without asynchronous processes we cannot have BUFFER == 0. */
264 && (INTEGERP (CONSP (args
[2]) ? XCAR (args
[2]) : args
[2])))
265 error ("Operating system cannot handle asynchronous subprocesses");
266 #endif /* subprocesses */
268 /* Decide the coding-system for giving arguments. */
270 Lisp_Object val
, *args2
;
273 /* If arguments are supplied, we may have to encode them. */
278 for (i
= 4; i
< nargs
; i
++)
279 CHECK_STRING (args
[i
]);
281 for (i
= 4; i
< nargs
; i
++)
282 if (STRING_MULTIBYTE (args
[i
]))
285 if (!NILP (Vcoding_system_for_write
))
286 val
= Vcoding_system_for_write
;
287 else if (! must_encode
)
291 args2
= (Lisp_Object
*) alloca ((nargs
+ 1) * sizeof *args2
);
292 args2
[0] = Qcall_process
;
293 for (i
= 0; i
< nargs
; i
++) args2
[i
+ 1] = args
[i
];
294 coding_systems
= Ffind_operation_coding_system (nargs
+ 1, args2
);
295 if (CONSP (coding_systems
))
296 val
= XCDR (coding_systems
);
297 else if (CONSP (Vdefault_process_coding_system
))
298 val
= XCDR (Vdefault_process_coding_system
);
302 setup_coding_system (Fcheck_coding_system (val
), &argument_coding
);
303 if (argument_coding
.common_flags
& CODING_ASCII_INCOMPATIBLE_MASK
)
304 setup_coding_system (Qraw_text
, &argument_coding
);
305 if (argument_coding
.eol_type
== CODING_EOL_UNDECIDED
)
306 argument_coding
.eol_type
= system_eol_type
;
310 if (nargs
>= 2 && ! NILP (args
[1]))
312 infile
= Fexpand_file_name (args
[1], current_buffer
->directory
);
313 CHECK_STRING (infile
);
316 infile
= build_string (NULL_DEVICE
);
322 /* If BUFFER is a list, its meaning is
323 (BUFFER-FOR-STDOUT FILE-FOR-STDERR). */
326 if (CONSP (XCDR (buffer
)))
328 Lisp_Object stderr_file
;
329 stderr_file
= XCAR (XCDR (buffer
));
331 if (NILP (stderr_file
) || EQ (Qt
, stderr_file
))
332 error_file
= stderr_file
;
334 error_file
= Fexpand_file_name (stderr_file
, Qnil
);
337 buffer
= XCAR (buffer
);
340 if (!(EQ (buffer
, Qnil
)
342 || INTEGERP (buffer
)))
344 Lisp_Object spec_buffer
;
345 spec_buffer
= buffer
;
346 buffer
= Fget_buffer_create (buffer
);
347 /* Mention the buffer name for a better error message. */
349 CHECK_BUFFER (spec_buffer
);
350 CHECK_BUFFER (buffer
);
356 /* Make sure that the child will be able to chdir to the current
357 buffer's current directory, or its unhandled equivalent. We
358 can't just have the child check for an error when it does the
359 chdir, since it's in a vfork.
361 We have to GCPRO around this because Fexpand_file_name,
362 Funhandled_file_name_directory, and Ffile_accessible_directory_p
363 might call a file name handling function. The argument list is
364 protected by the caller, so all we really have to worry about is
367 struct gcpro gcpro1
, gcpro2
, gcpro3
, gcpro4
;
369 current_dir
= current_buffer
->directory
;
371 GCPRO4 (infile
, buffer
, current_dir
, error_file
);
374 = expand_and_dir_to_file (Funhandled_file_name_directory (current_dir
),
376 if (NILP (Ffile_accessible_directory_p (current_dir
)))
377 report_file_error ("Setting current directory",
378 Fcons (current_buffer
->directory
, Qnil
));
380 if (STRING_MULTIBYTE (infile
))
381 infile
= ENCODE_FILE (infile
);
382 if (STRING_MULTIBYTE (current_dir
))
383 current_dir
= ENCODE_FILE (current_dir
);
384 if (STRINGP (error_file
) && STRING_MULTIBYTE (error_file
))
385 error_file
= ENCODE_FILE (error_file
);
389 display_p
= INTERACTIVE
&& nargs
>= 4 && !NILP (args
[3]);
391 filefd
= emacs_open (SDATA (infile
), O_RDONLY
, 0);
394 infile
= DECODE_FILE (infile
);
395 report_file_error ("Opening process input file", Fcons (infile
, Qnil
));
397 /* Search for program; barf if not found. */
401 GCPRO1 (current_dir
);
402 openp (Vexec_path
, args
[0], Vexec_suffixes
, &path
, make_number (X_OK
));
407 emacs_close (filefd
);
408 report_file_error ("Searching for program", Fcons (args
[0], Qnil
));
411 /* If program file name starts with /: for quoting a magic name,
413 if (SBYTES (path
) > 2 && SREF (path
, 0) == '/'
414 && SREF (path
, 1) == ':')
415 path
= Fsubstring (path
, make_number (2), Qnil
);
417 new_argv
[0] = SDATA (path
);
421 struct gcpro gcpro1
, gcpro2
, gcpro3
;
423 GCPRO3 (infile
, buffer
, current_dir
);
424 argument_coding
.dst_multibyte
= 0;
425 for (i
= 4; i
< nargs
; i
++)
427 argument_coding
.src_multibyte
= STRING_MULTIBYTE (args
[i
]);
428 if (CODING_REQUIRE_ENCODING (&argument_coding
))
430 /* We must encode this argument. */
431 args
[i
] = encode_coding_string (args
[i
], &argument_coding
, 1);
432 if (argument_coding
.type
== coding_type_ccl
)
433 setup_ccl_program (&(argument_coding
.spec
.ccl
.encoder
), Qnil
);
435 new_argv
[i
- 3] = SDATA (args
[i
]);
438 new_argv
[nargs
- 3] = 0;
443 #ifdef MSDOS /* MW, July 1993 */
444 if ((outf
= egetenv ("TMPDIR")))
445 strcpy (tempfile
= alloca (strlen (outf
) + 20), outf
);
448 tempfile
= alloca (20);
451 dostounix_filename (tempfile
);
452 if (*tempfile
== '\0' || tempfile
[strlen (tempfile
) - 1] != '/')
453 strcat (tempfile
, "/");
454 strcat (tempfile
, "detmp.XXX");
457 outfilefd
= creat (tempfile
, S_IREAD
| S_IWRITE
);
460 emacs_close (filefd
);
461 report_file_error ("Opening process output file",
462 Fcons (build_string (tempfile
), Qnil
));
469 /* Since we don't have pipes on the Mac, create a temporary file to
470 hold the output of the subprocess. */
471 tempfile
= (char *) alloca (SBYTES (Vtemp_file_name_pattern
) + 1);
472 bcopy (SDATA (Vtemp_file_name_pattern
), tempfile
,
473 SBYTES (Vtemp_file_name_pattern
) + 1);
477 outfilefd
= creat (tempfile
, S_IREAD
| S_IWRITE
);
481 report_file_error ("Opening process output file",
482 Fcons (build_string (tempfile
), Qnil
));
488 if (INTEGERP (buffer
))
489 fd
[1] = emacs_open (NULL_DEVICE
, O_WRONLY
, 0), fd
[0] = -1;
497 emacs_close (filefd
);
498 report_file_error ("Creating process pipe", Qnil
);
503 /* Replaced by close_process_descs */
504 set_exclusive_use (fd
[0]);
509 /* child_setup must clobber environ in systems with true vfork.
510 Protect it from permanent change. */
511 register char **save_environ
= environ
;
512 register int fd1
= fd
[1];
515 #if 0 /* Some systems don't have sigblock. */
516 mask
= sigblock (sigmask (SIGCHLD
));
519 /* Record that we're about to create a synchronous process. */
520 synch_process_alive
= 1;
522 /* These vars record information from process termination.
523 Clear them now before process can possibly terminate,
524 to avoid timing error if process terminates soon. */
525 synch_process_death
= 0;
526 synch_process_retcode
= 0;
527 synch_process_termsig
= 0;
529 if (NILP (error_file
))
530 fd_error
= emacs_open (NULL_DEVICE
, O_WRONLY
, 0);
531 else if (STRINGP (error_file
))
534 fd_error
= emacs_open (SDATA (error_file
),
535 O_WRONLY
| O_TRUNC
| O_CREAT
| O_TEXT
,
537 #else /* not DOS_NT */
538 fd_error
= creat (SDATA (error_file
), 0666);
539 #endif /* not DOS_NT */
544 emacs_close (filefd
);
552 if (NILP (error_file
))
553 error_file
= build_string (NULL_DEVICE
);
554 else if (STRINGP (error_file
))
555 error_file
= DECODE_FILE (error_file
);
556 report_file_error ("Cannot redirect stderr", Fcons (error_file
, Qnil
));
561 /* Call run_mac_command in sysdep.c here directly instead of doing
562 a child_setup as for MSDOS and other platforms. Note that this
563 code does not handle passing the environment to the synchronous
565 char *infn
, *outfn
, *errfn
, *currdn
;
567 /* close these files so subprocess can write to them */
569 if (fd_error
!= outfilefd
)
571 fd1
= -1; /* No harm in closing that one! */
573 infn
= SDATA (infile
);
575 if (NILP (error_file
))
577 else if (EQ (Qt
, error_file
))
580 errfn
= SDATA (error_file
);
581 currdn
= SDATA (current_dir
);
582 pid
= run_mac_command (new_argv
, currdn
, infn
, outfn
, errfn
);
584 /* Record that the synchronous process exited and note its
585 termination status. */
586 synch_process_alive
= 0;
587 synch_process_retcode
= pid
;
588 if (synch_process_retcode
< 0) /* means it couldn't be exec'ed */
590 synchronize_system_messages_locale ();
591 synch_process_death
= strerror (errno
);
594 /* Since CRLF is converted to LF within `decode_coding', we can
595 always open a file with binary mode. */
596 fd
[0] = open (tempfile
, O_BINARY
);
601 report_file_error ("Cannot re-open temporary file", Qnil
);
604 #else /* not MAC_OS8 */
605 #ifdef MSDOS /* MW, July 1993 */
606 /* Note that on MSDOS `child_setup' actually returns the child process
607 exit status, not its PID, so we assign it to `synch_process_retcode'
609 pid
= child_setup (filefd
, outfilefd
, fd_error
, (char **) new_argv
,
612 /* Record that the synchronous process exited and note its
613 termination status. */
614 synch_process_alive
= 0;
615 synch_process_retcode
= pid
;
616 if (synch_process_retcode
< 0) /* means it couldn't be exec'ed */
618 synchronize_system_messages_locale ();
619 synch_process_death
= strerror (errno
);
622 emacs_close (outfilefd
);
623 if (fd_error
!= outfilefd
)
624 emacs_close (fd_error
);
625 fd1
= -1; /* No harm in closing that one! */
626 /* Since CRLF is converted to LF within `decode_coding', we can
627 always open a file with binary mode. */
628 fd
[0] = emacs_open (tempfile
, O_RDONLY
| O_BINARY
, 0);
632 emacs_close (filefd
);
633 report_file_error ("Cannot re-open temporary file", Qnil
);
635 #else /* not MSDOS */
637 pid
= child_setup (filefd
, fd1
, fd_error
, (char **) new_argv
,
639 #else /* not WINDOWSNT */
651 #if defined (USG) && !defined (BSD_PGRPS)
656 child_setup (filefd
, fd1
, fd_error
, (char **) new_argv
,
661 #endif /* not WINDOWSNT */
663 /* The MSDOS case did this already. */
665 emacs_close (fd_error
);
666 #endif /* not MSDOS */
667 #endif /* not MAC_OS8 */
669 environ
= save_environ
;
671 /* Close most of our fd's, but not fd[0]
672 since we will use that to read input from. */
673 emacs_close (filefd
);
674 if (fd1
>= 0 && fd1
!= fd_error
)
682 report_file_error ("Doing vfork", Qnil
);
685 if (INTEGERP (buffer
))
690 /* If Emacs has been built with asynchronous subprocess support,
691 we don't need to do this, I think because it will then have
692 the facilities for handling SIGCHLD. */
693 wait_without_blocking ();
694 #endif /* subprocesses */
698 /* Enable sending signal if user quits below. */
699 call_process_exited
= 0;
701 #if defined(MSDOS) || defined(MAC_OS8)
702 /* MSDOS needs different cleanup information. */
703 record_unwind_protect (call_process_cleanup
,
704 Fcons (make_number (fd
[0]), build_string (tempfile
)));
706 record_unwind_protect (call_process_cleanup
,
707 Fcons (make_number (fd
[0]), make_number (pid
)));
708 #endif /* not MSDOS and not MAC_OS8 */
711 if (BUFFERP (buffer
))
712 Fset_buffer (buffer
);
716 /* If BUFFER is nil, we must read process output once and then
717 discard it, so setup coding system but with nil. */
718 setup_coding_system (Qnil
, &process_coding
);
722 Lisp_Object val
, *args2
;
725 if (!NILP (Vcoding_system_for_read
))
726 val
= Vcoding_system_for_read
;
729 if (EQ (coding_systems
, Qt
))
733 args2
= (Lisp_Object
*) alloca ((nargs
+ 1) * sizeof *args2
);
734 args2
[0] = Qcall_process
;
735 for (i
= 0; i
< nargs
; i
++) args2
[i
+ 1] = args
[i
];
737 = Ffind_operation_coding_system (nargs
+ 1, args2
);
739 if (CONSP (coding_systems
))
740 val
= XCAR (coding_systems
);
741 else if (CONSP (Vdefault_process_coding_system
))
742 val
= XCAR (Vdefault_process_coding_system
);
746 setup_coding_system (Fcheck_coding_system (val
), &process_coding
);
747 /* In unibyte mode, character code conversion should not take
748 place but EOL conversion should. So, setup raw-text or one
749 of the subsidiary according to the information just setup. */
750 if (NILP (current_buffer
->enable_multibyte_characters
)
752 setup_raw_text_coding_system (&process_coding
);
754 process_coding
.src_multibyte
= 0;
755 process_coding
.dst_multibyte
757 ? ! NILP (XBUFFER (buffer
)->enable_multibyte_characters
)
758 : ! NILP (current_buffer
->enable_multibyte_characters
));
768 int display_on_the_fly
= display_p
;
769 struct coding_system saved_coding
;
770 int pt_orig
= PT
, pt_byte_orig
= PT_BYTE
;
773 saved_coding
= process_coding
;
774 if (process_coding
.composing
!= COMPOSITION_DISABLED
)
775 coding_allocate_composition_data (&process_coding
, PT
);
778 /* Repeatedly read until we've filled as much as possible
779 of the buffer size we have. But don't read
780 less than 1024--save that for the next bufferful. */
782 while (nread
< bufsize
- 1024)
784 int this_read
= emacs_read (fd
[0], buf
+ nread
,
792 process_coding
.mode
|= CODING_MODE_LAST_BLOCK
;
797 total_read
+= this_read
;
799 if (display_on_the_fly
)
803 /* Now NREAD is the total amount of data in the buffer. */
808 if (! CODING_MAY_REQUIRE_DECODING (&process_coding
))
809 insert_1_both (buf
, nread
, nread
, 0, 1, 0);
811 { /* We have to decode the input. */
816 size
= decoding_buffer_size (&process_coding
, nread
);
817 decoding_buf
= (char *) xmalloc (size
);
819 /* We can't use the macro CODING_REQUIRE_DETECTION
820 because it always returns nonzero if the coding
821 system requires EOL detection. Here, we have to
822 check only whether or not the coding system
823 requires text-encoding detection. */
824 if (process_coding
.type
== coding_type_undecided
)
826 detect_coding (&process_coding
, buf
, nread
);
827 if (process_coding
.composing
!= COMPOSITION_DISABLED
)
828 /* We have not yet allocated the composition
829 data because the coding type was undecided. */
830 coding_allocate_composition_data (&process_coding
, PT
);
832 if (process_coding
.cmp_data
)
833 process_coding
.cmp_data
->char_offset
= PT
;
835 decode_coding (&process_coding
, buf
, decoding_buf
,
838 if (display_on_the_fly
839 && saved_coding
.type
== coding_type_undecided
840 && process_coding
.type
!= coding_type_undecided
)
842 /* We have detected some coding system. But,
843 there's a possibility that the detection was
844 done by insufficient data. So, we try the code
845 detection again with more data. */
846 xfree (decoding_buf
);
847 display_on_the_fly
= 0;
848 process_coding
= saved_coding
;
850 /* This is to make the above condition always
851 fails in the future. */
852 saved_coding
.type
= coding_type_no_conversion
;
856 if (process_coding
.produced
> 0)
857 insert_1_both (decoding_buf
, process_coding
.produced_char
,
858 process_coding
.produced
, 0, 1, 0);
859 xfree (decoding_buf
);
861 if (process_coding
.result
== CODING_FINISH_INCONSISTENT_EOL
)
863 Lisp_Object eol_type
, coding
;
865 if (process_coding
.eol_type
== CODING_EOL_CR
)
867 /* CRs have been replaced with LFs. Undo
868 that in the text inserted above. */
871 move_gap_both (PT
, PT_BYTE
);
873 p
= BYTE_POS_ADDR (pt_byte_orig
);
874 for (; p
< GPT_ADDR
; ++p
)
878 else if (process_coding
.eol_type
== CODING_EOL_CRLF
)
880 /* CR LFs have been replaced with LFs. Undo
881 that by inserting CRs in front of LFs in
882 the text inserted above. */
883 EMACS_INT bytepos
, old_pt
, old_pt_byte
, nCR
;
886 old_pt_byte
= PT_BYTE
;
889 for (bytepos
= PT_BYTE
- 1;
890 bytepos
>= pt_byte_orig
;
892 if (FETCH_BYTE (bytepos
) == '\n')
894 EMACS_INT charpos
= BYTE_TO_CHAR (bytepos
);
895 TEMP_SET_PT_BOTH (charpos
, bytepos
);
896 insert_1_both ("\r", 1, 1, 0, 1, 0);
900 TEMP_SET_PT_BOTH (old_pt
+ nCR
, old_pt_byte
+ nCR
);
903 /* Set the coding system symbol to that for
905 eol_type
= Fget (saved_coding
.symbol
, Qeol_type
);
906 if (VECTORP (eol_type
)
907 && ASIZE (eol_type
) == 3
908 && SYMBOLP (AREF (eol_type
, CODING_EOL_LF
)))
909 coding
= AREF (eol_type
, CODING_EOL_LF
);
911 coding
= saved_coding
.symbol
;
913 process_coding
.symbol
= coding
;
914 process_coding
.eol_type
= CODING_EOL_LF
;
916 &= ~CODING_MODE_INHIBIT_INCONSISTENT_EOL
;
919 nread
-= process_coding
.consumed
;
922 /* As CARRYOVER should not be that large, we had
923 better avoid overhead of bcopy. */
924 BCOPY_SHORT (buf
+ process_coding
.consumed
, buf
,
926 if (process_coding
.result
== CODING_FINISH_INSUFFICIENT_CMP
)
928 /* The decoding ended because of insufficient data
929 area to record information about composition.
930 We must try decoding with additional data area
931 before reading more output for the process. */
932 coding_allocate_composition_data (&process_coding
, PT
);
933 goto repeat_decoding
;
938 if (process_coding
.mode
& CODING_MODE_LAST_BLOCK
)
941 #if (CALLPROC_BUFFER_SIZE_MIN != CALLPROC_BUFFER_SIZE_MAX)
942 /* Make the buffer bigger as we continue to read more data,
943 but not past CALLPROC_BUFFER_SIZE_MAX. */
944 if (bufsize
< CALLPROC_BUFFER_SIZE_MAX
&& total_read
> 32 * bufsize
)
945 if ((bufsize
*= 2) > CALLPROC_BUFFER_SIZE_MAX
)
946 bufsize
= CALLPROC_BUFFER_SIZE_MAX
;
952 prepare_menu_bars ();
954 redisplay_preserve_echo_area (1);
955 /* This variable might have been set to 0 for code
956 detection. In that case, we set it back to 1 because
957 we should have already detected a coding system. */
958 display_on_the_fly
= 1;
966 && process_coding
.cmp_data
)
968 coding_restore_composition (&process_coding
, Fcurrent_buffer ());
969 coding_free_composition_data (&process_coding
);
973 int post_read_count
= SPECPDL_INDEX ();
975 record_unwind_protect (save_excursion_restore
, save_excursion_save ());
976 inserted
= PT
- pt_orig
;
977 TEMP_SET_PT_BOTH (pt_orig
, pt_byte_orig
);
978 if (SYMBOLP (process_coding
.post_read_conversion
)
979 && !NILP (Ffboundp (process_coding
.post_read_conversion
)))
980 call1 (process_coding
.post_read_conversion
, make_number (inserted
));
982 Vlast_coding_system_used
= process_coding
.symbol
;
984 /* If the caller required, let the buffer inherit the
985 coding-system used to decode the process output. */
986 if (inherit_process_coding_system
)
987 call1 (intern ("after-insert-file-set-buffer-file-coding-system"),
988 make_number (total_read
));
990 unbind_to (post_read_count
, Qnil
);
994 /* Wait for it to terminate, unless it already has. */
995 wait_for_termination (pid
);
999 set_buffer_internal (old
);
1001 /* Don't kill any children that the subprocess may have left behind
1003 call_process_exited
= 1;
1005 unbind_to (count
, Qnil
);
1007 if (synch_process_termsig
)
1011 synchronize_system_messages_locale ();
1012 signame
= strsignal (synch_process_termsig
);
1015 signame
= "unknown";
1017 synch_process_death
= signame
;
1020 if (synch_process_death
)
1021 return code_convert_string_norecord (build_string (synch_process_death
),
1022 Vlocale_coding_system
, 0);
1023 return make_number (synch_process_retcode
);
1028 delete_temp_file (name
)
1031 /* Suppress jka-compr handling, etc. */
1032 int count
= SPECPDL_INDEX ();
1033 specbind (intern ("file-name-handler-alist"), Qnil
);
1034 internal_delete_file (name
);
1035 unbind_to (count
, Qnil
);
1039 DEFUN ("call-process-region", Fcall_process_region
, Scall_process_region
,
1041 doc
: /* Send text from START to END to a synchronous process running PROGRAM.
1042 The remaining arguments are optional.
1043 Delete the text if fourth arg DELETE is non-nil.
1045 Insert output in BUFFER before point; t means current buffer;
1046 nil for BUFFER means discard it; 0 means discard and don't wait.
1047 BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case,
1048 REAL-BUFFER says what to do with standard output, as above,
1049 while STDERR-FILE says what to do with standard error in the child.
1050 STDERR-FILE may be nil (discard standard error output),
1051 t (mix it with ordinary output), or a file name string.
1053 Sixth arg DISPLAY non-nil means redisplay buffer as output is inserted.
1054 Remaining args are passed to PROGRAM at startup as command args.
1056 If BUFFER is 0, `call-process-region' returns immediately with value nil.
1057 Otherwise it waits for PROGRAM to terminate
1058 and returns a numeric exit status or a signal description string.
1059 If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.
1061 usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &rest ARGS) */)
1064 register Lisp_Object
*args
;
1066 struct gcpro gcpro1
;
1067 Lisp_Object filename_string
;
1068 register Lisp_Object start
, end
;
1069 int count
= SPECPDL_INDEX ();
1070 /* Qt denotes we have not yet called Ffind_operation_coding_system. */
1071 Lisp_Object coding_systems
;
1072 Lisp_Object val
, *args2
;
1078 if ((outf
= egetenv ("TMPDIR"))
1079 || (outf
= egetenv ("TMP"))
1080 || (outf
= egetenv ("TEMP")))
1081 strcpy (tempfile
= alloca (strlen (outf
) + 20), outf
);
1084 tempfile
= alloca (20);
1087 if (!IS_DIRECTORY_SEP (tempfile
[strlen (tempfile
) - 1]))
1088 strcat (tempfile
, "/");
1089 if ('/' == DIRECTORY_SEP
)
1090 dostounix_filename (tempfile
);
1092 unixtodos_filename (tempfile
);
1094 strcat (tempfile
, "emXXXXXX");
1096 strcat (tempfile
, "detmp.XXX");
1098 #else /* not DOS_NT */
1099 char *tempfile
= (char *) alloca (SBYTES (Vtemp_file_name_pattern
) + 1);
1100 bcopy (SDATA (Vtemp_file_name_pattern
), tempfile
,
1101 SBYTES (Vtemp_file_name_pattern
) + 1);
1102 #endif /* not DOS_NT */
1104 coding_systems
= Qt
;
1111 fd
= mkstemp (tempfile
);
1114 report_file_error ("Failed to open temporary file",
1115 Fcons (Vtemp_file_name_pattern
, Qnil
));
1123 filename_string
= build_string (tempfile
);
1124 GCPRO1 (filename_string
);
1127 /* Decide coding-system of the contents of the temporary file. */
1128 if (!NILP (Vcoding_system_for_write
))
1129 val
= Vcoding_system_for_write
;
1130 else if (NILP (current_buffer
->enable_multibyte_characters
))
1134 args2
= (Lisp_Object
*) alloca ((nargs
+ 1) * sizeof *args2
);
1135 args2
[0] = Qcall_process_region
;
1136 for (i
= 0; i
< nargs
; i
++) args2
[i
+ 1] = args
[i
];
1137 coding_systems
= Ffind_operation_coding_system (nargs
+ 1, args2
);
1138 if (CONSP (coding_systems
))
1139 val
= XCDR (coding_systems
);
1140 else if (CONSP (Vdefault_process_coding_system
))
1141 val
= XCDR (Vdefault_process_coding_system
);
1147 int count1
= SPECPDL_INDEX ();
1149 specbind (intern ("coding-system-for-write"), val
);
1150 /* POSIX lets mk[s]temp use "."; don't invoke jka-compr if we
1151 happen to get a ".Z" suffix. */
1152 specbind (intern ("file-name-handler-alist"), Qnil
);
1153 Fwrite_region (start
, end
, filename_string
, Qnil
, Qlambda
, Qnil
, Qnil
);
1155 unbind_to (count1
, Qnil
);
1158 /* Note that Fcall_process takes care of binding
1159 coding-system-for-read. */
1161 record_unwind_protect (delete_temp_file
, filename_string
);
1163 if (nargs
> 3 && !NILP (args
[3]))
1164 Fdelete_region (start
, end
);
1176 args
[1] = filename_string
;
1178 RETURN_UNGCPRO (unbind_to (count
, Fcall_process (nargs
, args
)));
1181 #ifndef VMS /* VMS version is in vmsproc.c. */
1183 static int relocate_fd ();
1185 /* This is the last thing run in a newly forked inferior
1186 either synchronous or asynchronous.
1187 Copy descriptors IN, OUT and ERR as descriptors 0, 1 and 2.
1188 Initialize inferior's priority, pgrp, connected dir and environment.
1189 then exec another program based on new_argv.
1191 This function may change environ for the superior process.
1192 Therefore, the superior process must save and restore the value
1193 of environ around the vfork and the call to this function.
1195 SET_PGRP is nonzero if we should put the subprocess into a separate
1198 CURRENT_DIR is an elisp string giving the path of the current
1199 directory the subprocess should have. Since we can't really signal
1200 a decent error from within the child, this should be verified as an
1201 executable directory by the parent. */
1204 child_setup (in
, out
, err
, new_argv
, set_pgrp
, current_dir
)
1206 register char **new_argv
;
1208 Lisp_Object current_dir
;
1215 #endif /* WINDOWSNT */
1217 int pid
= getpid ();
1219 #ifdef SET_EMACS_PRIORITY
1221 extern EMACS_INT emacs_priority
;
1223 if (emacs_priority
< 0)
1224 nice (- emacs_priority
);
1229 /* Close Emacs's descriptors that this process should not have. */
1230 close_process_descs ();
1232 /* DOS_NT isn't in a vfork, so if we are in the middle of load-file,
1233 we will lose if we call close_load_descs here. */
1235 close_load_descs ();
1238 /* Note that use of alloca is always safe here. It's obvious for systems
1239 that do not have true vfork or that have true (stack) alloca.
1240 If using vfork and C_ALLOCA it is safe because that changes
1241 the superior's static variables as if the superior had done alloca
1242 and will be cleaned up in the usual way. */
1244 register char *temp
;
1247 i
= SBYTES (current_dir
);
1249 /* MSDOS must have all environment variables malloc'ed, because
1250 low-level libc functions that launch subsidiary processes rely
1252 pwd_var
= (char *) xmalloc (i
+ 6);
1254 pwd_var
= (char *) alloca (i
+ 6);
1257 bcopy ("PWD=", pwd_var
, 4);
1258 bcopy (SDATA (current_dir
), temp
, i
);
1259 if (!IS_DIRECTORY_SEP (temp
[i
- 1])) temp
[i
++] = DIRECTORY_SEP
;
1263 /* We can't signal an Elisp error here; we're in a vfork. Since
1264 the callers check the current directory before forking, this
1265 should only return an error if the directory's permissions
1266 are changed between the check and this chdir, but we should
1268 if (chdir (temp
) < 0)
1273 /* Get past the drive letter, so that d:/ is left alone. */
1274 if (i
> 2 && IS_DEVICE_SEP (temp
[1]) && IS_DIRECTORY_SEP (temp
[2]))
1281 /* Strip trailing slashes for PWD, but leave "/" and "//" alone. */
1282 while (i
> 2 && IS_DIRECTORY_SEP (temp
[i
- 1]))
1286 /* Set `env' to a vector of the strings in Vprocess_environment. */
1288 register Lisp_Object tem
;
1289 register char **new_env
;
1290 register int new_length
;
1293 for (tem
= Vprocess_environment
;
1294 CONSP (tem
) && STRINGP (XCAR (tem
));
1298 /* new_length + 2 to include PWD and terminating 0. */
1299 env
= new_env
= (char **) alloca ((new_length
+ 2) * sizeof (char *));
1301 /* If we have a PWD envvar, pass one down,
1302 but with corrected value. */
1304 *new_env
++ = pwd_var
;
1306 /* Copy the Vprocess_environment strings into new_env. */
1307 for (tem
= Vprocess_environment
;
1308 CONSP (tem
) && STRINGP (XCAR (tem
));
1312 char *string
= (char *) SDATA (XCAR (tem
));
1313 /* See if this string duplicates any string already in the env.
1314 If so, don't put it in.
1315 When an env var has multiple definitions,
1316 we keep the definition that comes first in process-environment. */
1317 for (; ep
!= new_env
; ep
++)
1319 char *p
= *ep
, *q
= string
;
1323 /* The string is malformed; might as well drop it. */
1332 *new_env
++ = string
;
1338 prepare_standard_handles (in
, out
, err
, handles
);
1339 set_process_dir (SDATA (current_dir
));
1340 #else /* not WINDOWSNT */
1341 /* Make sure that in, out, and err are not actually already in
1342 descriptors zero, one, or two; this could happen if Emacs is
1343 started with its standard in, out, or error closed, as might
1346 int oin
= in
, oout
= out
;
1348 /* We have to avoid relocating the same descriptor twice! */
1350 in
= relocate_fd (in
, 3);
1355 out
= relocate_fd (out
, 3);
1359 else if (err
== oout
)
1362 err
= relocate_fd (err
, 3);
1376 #endif /* not MSDOS */
1377 #endif /* not WINDOWSNT */
1379 #if defined(USG) && !defined(BSD_PGRPS)
1380 #ifndef SETPGRP_RELEASES_CTTY
1381 setpgrp (); /* No arguments but equivalent in this case */
1386 /* setpgrp_of_tty is incorrect here; it uses input_fd. */
1387 EMACS_SET_TTY_PGRP (0, &pid
);
1390 pid
= run_msdos_command (new_argv
, pwd_var
+ 4, in
, out
, err
, env
);
1393 /* An error occurred while trying to run the subprocess. */
1394 report_file_error ("Spawning child process", Qnil
);
1396 #else /* not MSDOS */
1398 /* Spawn the child. (See ntproc.c:Spawnve). */
1399 cpid
= spawnve (_P_NOWAIT
, new_argv
[0], new_argv
, env
);
1400 reset_standard_handles (in
, out
, err
, handles
);
1402 /* An error occurred while trying to spawn the process. */
1403 report_file_error ("Spawning child process", Qnil
);
1405 #else /* not WINDOWSNT */
1406 /* execvp does not accept an environment arg so the only way
1407 to pass this environment is to set environ. Our caller
1408 is responsible for restoring the ambient value of environ. */
1410 execvp (new_argv
[0], new_argv
);
1412 emacs_write (1, "Can't exec program: ", 20);
1413 emacs_write (1, new_argv
[0], strlen (new_argv
[0]));
1414 emacs_write (1, "\n", 1);
1416 #endif /* not WINDOWSNT */
1417 #endif /* not MSDOS */
1420 /* Move the file descriptor FD so that its number is not less than MINFD.
1421 If the file descriptor is moved at all, the original is freed. */
1423 relocate_fd (fd
, minfd
)
1433 char *message1
= "Error while setting up child: ";
1434 char *errmessage
= strerror (errno
);
1435 char *message2
= "\n";
1436 emacs_write (2, message1
, strlen (message1
));
1437 emacs_write (2, errmessage
, strlen (errmessage
));
1438 emacs_write (2, message2
, strlen (message2
));
1441 /* Note that we hold the original FD open while we recurse,
1442 to guarantee we'll get a new FD if we need it. */
1443 new = relocate_fd (new, minfd
);
1450 getenv_internal (var
, varlen
, value
, valuelen
)
1458 for (scan
= Vprocess_environment
; CONSP (scan
); scan
= XCDR (scan
))
1462 entry
= XCAR (scan
);
1464 && SBYTES (entry
) > varlen
1465 && SREF (entry
, varlen
) == '='
1467 /* NT environment variables are case insensitive. */
1468 && ! strnicmp (SDATA (entry
), var
, varlen
)
1469 #else /* not WINDOWSNT */
1470 && ! bcmp (SDATA (entry
), var
, varlen
)
1471 #endif /* not WINDOWSNT */
1474 *value
= (char *) SDATA (entry
) + (varlen
+ 1);
1475 *valuelen
= SBYTES (entry
) - (varlen
+ 1);
1483 DEFUN ("getenv-internal", Fgetenv_internal
, Sgetenv_internal
, 1, 1, 0,
1484 doc
: /* Return the value of environment variable VAR, as a string.
1485 VAR should be a string. Value is nil if VAR is undefined in the environment.
1486 This function consults the variable `process-environment' for its value. */)
1494 if (getenv_internal (SDATA (var
), SBYTES (var
),
1496 return make_string (value
, valuelen
);
1501 /* A version of getenv that consults process_environment, easily
1510 if (getenv_internal (var
, strlen (var
), &value
, &valuelen
))
1516 #endif /* not VMS */
1518 /* This is run before init_cmdargs. */
1523 char *data_dir
= egetenv ("EMACSDATA");
1524 char *doc_dir
= egetenv ("EMACSDOC");
1527 = Ffile_name_as_directory (build_string (data_dir
? data_dir
1530 = Ffile_name_as_directory (build_string (doc_dir
? doc_dir
1533 /* Check the EMACSPATH environment variable, defaulting to the
1534 PATH_EXEC path from epaths.h. */
1535 Vexec_path
= decode_env_path ("EMACSPATH", PATH_EXEC
);
1536 Vexec_directory
= Ffile_name_as_directory (Fcar (Vexec_path
));
1537 Vexec_path
= nconc2 (decode_env_path ("PATH", ""), Vexec_path
);
1540 /* This is run after init_cmdargs, when Vinstallation_directory is valid. */
1545 char *data_dir
= egetenv ("EMACSDATA");
1548 Lisp_Object tempdir
;
1550 if (!NILP (Vinstallation_directory
))
1552 /* Add to the path the lib-src subdir of the installation dir. */
1554 tem
= Fexpand_file_name (build_string ("lib-src"),
1555 Vinstallation_directory
);
1557 /* MSDOS uses wrapped binaries, so don't do this. */
1558 if (NILP (Fmember (tem
, Vexec_path
)))
1560 Vexec_path
= decode_env_path ("EMACSPATH", PATH_EXEC
);
1561 Vexec_path
= Fcons (tem
, Vexec_path
);
1562 Vexec_path
= nconc2 (decode_env_path ("PATH", ""), Vexec_path
);
1565 Vexec_directory
= Ffile_name_as_directory (tem
);
1566 #endif /* not DOS_NT */
1568 /* Maybe use ../etc as well as ../lib-src. */
1571 tem
= Fexpand_file_name (build_string ("etc"),
1572 Vinstallation_directory
);
1573 Vdoc_directory
= Ffile_name_as_directory (tem
);
1577 /* Look for the files that should be in etc. We don't use
1578 Vinstallation_directory, because these files are never installed
1579 near the executable, and they are never in the build
1580 directory when that's different from the source directory.
1582 Instead, if these files are not in the nominal place, we try the
1583 source directory. */
1586 Lisp_Object tem
, tem1
, srcdir
;
1588 srcdir
= Fexpand_file_name (build_string ("../src/"),
1589 build_string (PATH_DUMPLOADSEARCH
));
1590 tem
= Fexpand_file_name (build_string ("GNU"), Vdata_directory
);
1591 tem1
= Ffile_exists_p (tem
);
1592 if (!NILP (Fequal (srcdir
, Vinvocation_directory
)) || NILP (tem1
))
1595 newdir
= Fexpand_file_name (build_string ("../etc/"),
1596 build_string (PATH_DUMPLOADSEARCH
));
1597 tem
= Fexpand_file_name (build_string ("GNU"), newdir
);
1598 tem1
= Ffile_exists_p (tem
);
1600 Vdata_directory
= newdir
;
1608 tempdir
= Fdirectory_file_name (Vexec_directory
);
1609 if (access (SDATA (tempdir
), 0) < 0)
1610 dir_warning ("Warning: arch-dependent data dir (%s) does not exist.\n",
1614 tempdir
= Fdirectory_file_name (Vdata_directory
);
1615 if (access (SDATA (tempdir
), 0) < 0)
1616 dir_warning ("Warning: arch-independent data dir (%s) does not exist.\n",
1620 Vshell_file_name
= build_string ("*dcl*");
1622 sh
= (char *) getenv ("SHELL");
1623 Vshell_file_name
= build_string (sh
? sh
: "/bin/sh");
1627 Vtemp_file_name_pattern
= build_string ("tmp:emacsXXXXXX.");
1629 if (getenv ("TMPDIR"))
1631 char *dir
= getenv ("TMPDIR");
1632 Vtemp_file_name_pattern
1633 = Fexpand_file_name (build_string ("emacsXXXXXX"),
1634 build_string (dir
));
1637 Vtemp_file_name_pattern
= build_string ("/tmp/emacsXXXXXX");
1641 Vshared_game_score_directory
= Qnil
;
1643 Vshared_game_score_directory
= build_string (PATH_GAME
);
1644 if (NILP (Ffile_directory_p (Vshared_game_score_directory
)))
1645 Vshared_game_score_directory
= Qnil
;
1650 set_process_environment ()
1652 register char **envp
;
1654 Vprocess_environment
= Qnil
;
1658 for (envp
= environ
; *envp
; envp
++)
1659 Vprocess_environment
= Fcons (build_string (*envp
),
1660 Vprocess_environment
);
1667 Qbuffer_file_type
= intern ("buffer-file-type");
1668 staticpro (&Qbuffer_file_type
);
1671 DEFVAR_LISP ("shell-file-name", &Vshell_file_name
,
1672 doc
: /* *File name to load inferior shells from.
1673 Initialized from the SHELL environment variable, or to a system-dependent
1674 default if SHELL is not set. */);
1676 DEFVAR_LISP ("exec-path", &Vexec_path
,
1677 doc
: /* *List of directories to search programs to run in subprocesses.
1678 Each element is a string (directory name) or nil (try default directory). */);
1680 DEFVAR_LISP ("exec-suffixes", &Vexec_suffixes
,
1681 doc
: /* *List of suffixes to try to find executable file names.
1682 Each element is a string. */);
1683 Vexec_suffixes
= Qnil
;
1685 DEFVAR_LISP ("exec-directory", &Vexec_directory
,
1686 doc
: /* Directory for executables for Emacs to invoke.
1687 More generally, this includes any architecture-dependent files
1688 that are built and installed from the Emacs distribution. */);
1690 DEFVAR_LISP ("data-directory", &Vdata_directory
,
1691 doc
: /* Directory of machine-independent files that come with GNU Emacs.
1692 These are files intended for Emacs to use while it runs. */);
1694 DEFVAR_LISP ("doc-directory", &Vdoc_directory
,
1695 doc
: /* Directory containing the DOC file that comes with GNU Emacs.
1696 This is usually the same as `data-directory'. */);
1698 DEFVAR_LISP ("configure-info-directory", &Vconfigure_info_directory
,
1699 doc
: /* For internal use by the build procedure only.
1700 This is the name of the directory in which the build procedure installed
1701 Emacs's info files; the default value for `Info-default-directory-list'
1703 Vconfigure_info_directory
= build_string (PATH_INFO
);
1705 DEFVAR_LISP ("shared-game-score-directory", &Vshared_game_score_directory
,
1706 doc
: /* Directory of score files for games which come with GNU Emacs.
1707 If this variable is nil, then Emacs is unable to use a shared directory. */);
1709 Vshared_game_score_directory
= Qnil
;
1711 Vshared_game_score_directory
= build_string (PATH_GAME
);
1714 DEFVAR_LISP ("temp-file-name-pattern", &Vtemp_file_name_pattern
,
1715 doc
: /* Pattern for making names for temporary files.
1716 This is used by `call-process-region'. */);
1717 /* This variable is initialized in init_callproc. */
1719 DEFVAR_LISP ("process-environment", &Vprocess_environment
,
1720 doc
: /* List of environment variables for subprocesses to inherit.
1721 Each element should be a string of the form ENVVARNAME=VALUE.
1722 If multiple entries define the same variable, the first one always
1724 The environment which Emacs inherits is placed in this variable
1726 Non-ASCII characters are encoded according to the initial value of
1727 `locale-coding-system', i.e. the elements must normally be decoded for use.
1728 See `setenv' and `getenv'. */);
1731 defsubr (&Scall_process
);
1732 defsubr (&Sgetenv_internal
);
1734 defsubr (&Scall_process_region
);
1737 /* arch-tag: 769b8045-1df7-4d2b-8968-e3fb49017f95
1738 (do not change this comment) */