aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c45
1 files changed, 8 insertions, 37 deletions
diff --git a/src/callproc.c b/src/callproc.c
index 8c1384df6a1..ee0872b5562 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -24,13 +24,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24#include <errno.h> 24#include <errno.h>
25#include <stdio.h> 25#include <stdio.h>
26#include <setjmp.h> 26#include <setjmp.h>
27
28/* Define SIGCHLD as an alias for SIGCLD. */
29
30#if !defined (SIGCHLD) && defined (SIGCLD)
31#define SIGCHLD SIGCLD
32#endif /* SIGCLD */
33
34#include <sys/types.h> 27#include <sys/types.h>
35 28
36#ifdef HAVE_UNISTD_H 29#ifdef HAVE_UNISTD_H
@@ -38,33 +31,20 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
38#endif 31#endif
39 32
40#include <sys/file.h> 33#include <sys/file.h>
41#ifdef HAVE_FCNTL_H
42#include <fcntl.h> 34#include <fcntl.h>
43#endif
44 35
45#ifdef WINDOWSNT 36#ifdef WINDOWSNT
46#define NOMINMAX 37#define NOMINMAX
47#include <windows.h> 38#include <windows.h>
48#include <stdlib.h> /* for proper declaration of environ */
49#include <fcntl.h>
50#include "w32.h" 39#include "w32.h"
51#define _P_NOWAIT 1 /* from process.h */ 40#define _P_NOWAIT 1 /* from process.h */
52#endif 41#endif
53 42
54#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ 43#ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */
55#include <fcntl.h>
56#include <sys/stat.h> 44#include <sys/stat.h>
57#include <sys/param.h> 45#include <sys/param.h>
58#endif /* MSDOS */ 46#endif /* MSDOS */
59 47
60#ifndef O_RDONLY
61#define O_RDONLY 0
62#endif
63
64#ifndef O_WRONLY
65#define O_WRONLY 1
66#endif
67
68#include "lisp.h" 48#include "lisp.h"
69#include "commands.h" 49#include "commands.h"
70#include "buffer.h" 50#include "buffer.h"
@@ -274,21 +254,16 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
274 if (!NILP (Vcoding_system_for_write)) 254 if (!NILP (Vcoding_system_for_write))
275 val = Vcoding_system_for_write; 255 val = Vcoding_system_for_write;
276 else if (! must_encode) 256 else if (! must_encode)
277 val = Qnil; 257 val = Qraw_text;
278 else 258 else
279 { 259 {
280 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 260 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
281 args2[0] = Qcall_process; 261 args2[0] = Qcall_process;
282 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 262 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
283 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 263 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
284 if (CONSP (coding_systems)) 264 val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil;
285 val = XCDR (coding_systems);
286 else if (CONSP (Vdefault_process_coding_system))
287 val = XCDR (Vdefault_process_coding_system);
288 else
289 val = Qnil;
290 } 265 }
291 val = coding_inherit_eol_type (val, Qnil); 266 val = complement_process_encoding_system (val);
292 setup_coding_system (Fcheck_coding_system (val), &argument_coding); 267 setup_coding_system (Fcheck_coding_system (val), &argument_coding);
293 coding_attrs = CODING_ID_ATTRS (argument_coding.id); 268 coding_attrs = CODING_ID_ATTRS (argument_coding.id);
294 if (NILP (CODING_ATTR_ASCII_COMPAT (coding_attrs))) 269 if (NILP (CODING_ATTR_ASCII_COMPAT (coding_attrs)))
@@ -678,9 +653,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
678 QUIT; 653 QUIT;
679 654
680 { 655 {
681 register int nread; 656 register EMACS_INT nread;
682 int first = 1; 657 int first = 1;
683 int total_read = 0; 658 EMACS_INT total_read = 0;
684 int carryover = 0; 659 int carryover = 0;
685 int display_on_the_fly = display_p; 660 int display_on_the_fly = display_p;
686 struct coding_system saved_coding; 661 struct coding_system saved_coding;
@@ -932,20 +907,16 @@ usage: (call-process-region START END PROGRAM &optional DELETE BUFFER DISPLAY &r
932 if (!NILP (Vcoding_system_for_write)) 907 if (!NILP (Vcoding_system_for_write))
933 val = Vcoding_system_for_write; 908 val = Vcoding_system_for_write;
934 else if (NILP (current_buffer->enable_multibyte_characters)) 909 else if (NILP (current_buffer->enable_multibyte_characters))
935 val = Qnil; 910 val = Qraw_text;
936 else 911 else
937 { 912 {
938 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2); 913 args2 = (Lisp_Object *) alloca ((nargs + 1) * sizeof *args2);
939 args2[0] = Qcall_process_region; 914 args2[0] = Qcall_process_region;
940 for (i = 0; i < nargs; i++) args2[i + 1] = args[i]; 915 for (i = 0; i < nargs; i++) args2[i + 1] = args[i];
941 coding_systems = Ffind_operation_coding_system (nargs + 1, args2); 916 coding_systems = Ffind_operation_coding_system (nargs + 1, args2);
942 if (CONSP (coding_systems)) 917 val = CONSP (coding_systems) ? XCDR (coding_systems) : Qnil;
943 val = XCDR (coding_systems);
944 else if (CONSP (Vdefault_process_coding_system))
945 val = XCDR (Vdefault_process_coding_system);
946 else
947 val = Qnil;
948 } 918 }
919 val = complement_process_encoding_system (val);
949 920
950 { 921 {
951 int count1 = SPECPDL_INDEX (); 922 int count1 = SPECPDL_INDEX ();