comparison src/callproc.c @ 21564:62a4efbdc4b4

Remove binary-process-{in,out}put. (syms_of_callproc): Likewise. (Fcall_process, Fcall_process_region): Don't use binary-process-{in,out}put.
author Eli Zaretskii <eliz@gnu.org>
date Wed, 15 Apr 1998 14:36:16 +0000
parents fa9ff387d260
children 395ad34c576a
comparison
equal deleted inserted replaced
21563:865571797d0b 21564:62a4efbdc4b4
83 #else 83 #else
84 extern char **environ; 84 extern char **environ;
85 #endif 85 #endif
86 86
87 #define max(a, b) ((a) > (b) ? (a) : (b)) 87 #define max(a, b) ((a) > (b) ? (a) : (b))
88
89 #ifdef DOS_NT
90 /* When we are starting external processes we need to know whether they
91 take binary input (no conversion) or text input (\n is converted to
92 \r\n). Similar for output: if newlines are written as \r\n then it's
93 text process output, otherwise it's binary. */
94 Lisp_Object Vbinary_process_input;
95 Lisp_Object Vbinary_process_output;
96 #endif /* DOS_NT */
97 88
98 Lisp_Object Vexec_path, Vexec_directory, Vdata_directory, Vdoc_directory; 89 Lisp_Object Vexec_path, Vexec_directory, Vdata_directory, Vdoc_directory;
99 Lisp_Object Vconfigure_info_directory; 90 Lisp_Object Vconfigure_info_directory;
100 Lisp_Object Vtemp_file_name_pattern; 91 Lisp_Object Vtemp_file_name_pattern;
101 92
302 val = XCONS (Vdefault_process_coding_system)->car; 293 val = XCONS (Vdefault_process_coding_system)->car;
303 else 294 else
304 val = Qnil; 295 val = Qnil;
305 } 296 }
306 setup_coding_system (Fcheck_coding_system (val), &process_coding); 297 setup_coding_system (Fcheck_coding_system (val), &process_coding);
307 #ifdef MSDOS
308 /* On MSDOS, if the user did not ask for binary, treat it as
309 "text" which means doing CRLF conversion. Otherwise, leave
310 the EOLs alone.
311
312 Note that ``binary'' here only means whether EOLs should or
313 should not be converted, since that's what Vbinary_process_XXXput
314 meant in the days before the coding systems were introduced.
315
316 For other conversions, the caller should set coding-system
317 variables explicitly, or rely on auto-detection. */
318
319 /* FIXME: this probably should be moved into the guts of
320 `Ffind_operation_coding_system' for the case of `call-process'. */
321 if (NILP (Vbinary_process_output))
322 {
323 process_coding.eol_type = CODING_EOL_CRLF;
324 if (process_coding.type == coding_type_no_conversion)
325 /* FIXME: should we set type to undecided? */
326 process_coding.type = coding_type_emacs_mule;
327 }
328 else
329 process_coding.eol_type = CODING_EOL_LF;
330 #endif
331 } 298 }
332 } 299 }
333 300
334 if (nargs >= 2 && ! NILP (args[1])) 301 if (nargs >= 2 && ! NILP (args[1]))
335 { 302 {
847 filename_string = build_string (tempfile); 814 filename_string = build_string (tempfile);
848 GCPRO1 (filename_string); 815 GCPRO1 (filename_string);
849 start = args[0]; 816 start = args[0];
850 end = args[1]; 817 end = args[1];
851 /* Decide coding-system of the contents of the temporary file. */ 818 /* Decide coding-system of the contents of the temporary file. */
852 #ifdef DOS_NT
853 /* This is to cause find-buffer-file-type-coding-system (see
854 dos-w32.el) to choose correct EOL translation for write-region. */
855 specbind (Qbuffer_file_type, Vbinary_process_input);
856 #endif
857 if (!NILP (Vcoding_system_for_write)) 819 if (!NILP (Vcoding_system_for_write))
858 val = Vcoding_system_for_write; 820 val = Vcoding_system_for_write;
859 else if (NILP (current_buffer->enable_multibyte_characters)) 821 else if (NILP (current_buffer->enable_multibyte_characters))
860 val = Qnil; 822 val = Qnil;
861 else 823 else
869 else if (CONSP (Vdefault_process_coding_system)) 831 else if (CONSP (Vdefault_process_coding_system))
870 val = XCONS (Vdefault_process_coding_system)->cdr; 832 val = XCONS (Vdefault_process_coding_system)->cdr;
871 else 833 else
872 val = Qnil; 834 val = Qnil;
873 } 835 }
874
875 #ifdef DOS_NT
876 /* binary-process-input tells whether the buffer needs to be
877 written with EOL conversions, but it doesn't say anything
878 about the rest of text encoding. It takes effect whenever
879 the coding system doesn't otherwise specify what to do for
880 eol conversion. */
881 if (NILP (val))
882 {
883 if (! NILP (Vbinary_process_input))
884 val = intern ("undecided-unix");
885 else
886 val = intern ("undecided-dos");
887 }
888 else if (SYMBOLP (val) && NILP (Vcoding_system_for_write))
889 {
890 Lisp_Object eolval;
891 eolval = Fget (val, Qeol_type);
892 if (VECTORP (eolval) && XVECTOR (eolval)->size > 1)
893 /* Use element 1 (CRLF conversion) for "text",
894 and element 0 (LF conversion) for "binary". */
895 val = XVECTOR (eolval)->contents[NILP (Vbinary_process_input)];
896 }
897 #endif
898 836
899 specbind (intern ("coding-system-for-write"), val); 837 specbind (intern ("coding-system-for-write"), val);
900 Fwrite_region (start, end, filename_string, Qnil, Qlambda, Qnil, Qnil); 838 Fwrite_region (start, end, filename_string, Qnil, Qlambda, Qnil, Qnil);
901 839
902 /* Note that Fcall_process takes care of binding 840 /* Note that Fcall_process takes care of binding
1364 syms_of_callproc () 1302 syms_of_callproc ()
1365 { 1303 {
1366 #ifdef DOS_NT 1304 #ifdef DOS_NT
1367 Qbuffer_file_type = intern ("buffer-file-type"); 1305 Qbuffer_file_type = intern ("buffer-file-type");
1368 staticpro (&Qbuffer_file_type); 1306 staticpro (&Qbuffer_file_type);
1369
1370 DEFVAR_LISP ("binary-process-input", &Vbinary_process_input,
1371 "*If non-nil then new subprocesses are assumed to take binary input.");
1372 Vbinary_process_input = Qnil;
1373
1374 DEFVAR_LISP ("binary-process-output", &Vbinary_process_output,
1375 "*If non-nil then new subprocesses are assumed to produce binary output.");
1376 Vbinary_process_output = Qnil;
1377 #endif /* DOS_NT */ 1307 #endif /* DOS_NT */
1378 1308
1379 DEFVAR_LISP ("shell-file-name", &Vshell_file_name, 1309 DEFVAR_LISP ("shell-file-name", &Vshell_file_name,
1380 "*File name to load inferior shells from.\n\ 1310 "*File name to load inferior shells from.\n\
1381 Initialized from the SHELL environment variable."); 1311 Initialized from the SHELL environment variable.");