aboutsummaryrefslogtreecommitdiffstats
path: root/src/process.c
diff options
context:
space:
mode:
authorKenichi Handa1997-11-08 03:05:44 +0000
committerKenichi Handa1997-11-08 03:05:44 +0000
commit1a283a4c9e720c25cf526a573261a6ab141f1d73 (patch)
tree2585b03b4608dd3db80b05ada02ff0eb2a636489 /src/process.c
parent6ad0beebd0dde0ffdae85dfe16dc89ffb1a49205 (diff)
downloademacs-1a283a4c9e720c25cf526a573261a6ab141f1d73.tar.gz
emacs-1a283a4c9e720c25cf526a573261a6ab141f1d73.zip
(create_process): Encode arguments for the process.
(read_process_output): Use new macros defined in coding.h. (send_process): Likewise.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/src/process.c b/src/process.c
index af7cf2a28fb..25cdcca9cb2 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1399,6 +1399,35 @@ create_process (process, new_argv, current_dir)
1399 setup_coding_system (XPROCESS (process)->encode_coding_system, 1399 setup_coding_system (XPROCESS (process)->encode_coding_system,
1400 proc_encode_coding_system[outchannel]); 1400 proc_encode_coding_system[outchannel]);
1401 1401
1402 if (CODING_REQUIRE_ENCODING (proc_encode_coding_system[outchannel]))
1403 {
1404 /* Here we encode arguments by the coding system used for
1405 sending data to the process. We don't support using
1406 different coding systems for encoding arguments and for
1407 encoding data sent to the process. */
1408 struct gcpro gcpro1;
1409 int i = 1;
1410 struct coding_system *coding = proc_encode_coding_system[outchannel];
1411
1412 coding->last_block = 1;
1413 GCPRO1 (process);
1414 while (new_argv[i] != 0)
1415 {
1416 int len = strlen (new_argv[i]);
1417 int size = encoding_buffer_size (coding, len);
1418 unsigned char *buf = (unsigned char *) alloca (size);
1419 int produced, dmy;
1420
1421 produced = encode_coding (coding, new_argv[i], buf, len, size, &dmy);
1422 buf[produced] = 0;
1423 /* We don't have to free new_argv[i] because it points to a
1424 Lisp string given as an argument to `start-process'. */
1425 new_argv[i++] = buf;
1426 }
1427 UNGCPRO;
1428 coding->last_block = 0;
1429 }
1430
1402 /* Delay interrupts until we have a chance to store 1431 /* Delay interrupts until we have a chance to store
1403 the new fork's pid in its process structure */ 1432 the new fork's pid in its process structure */
1404#ifdef POSIX_SIGNALS 1433#ifdef POSIX_SIGNALS
@@ -2754,7 +2783,8 @@ read_process_output (proc, channel)
2754 /* Now set NCHARS how many bytes we must decode. */ 2783 /* Now set NCHARS how many bytes we must decode. */
2755 nchars += coding->carryover_size; 2784 nchars += coding->carryover_size;
2756 2785
2757 if (! CODING_REQUIRE_NO_CONVERSION (coding)) 2786 if (CODING_REQUIRE_DECODING (coding)
2787 || CODING_REQUIRE_DETECTION (coding))
2758 { 2788 {
2759 int require = decoding_buffer_size (coding, nchars); 2789 int require = decoding_buffer_size (coding, nchars);
2760 int consumed, produced; 2790 int consumed, produced;
@@ -3010,7 +3040,7 @@ send_process (proc, buf, len, object)
3010 error ("Output file descriptor of %s is closed", procname); 3040 error ("Output file descriptor of %s is closed", procname);
3011 3041
3012 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)]; 3042 coding = proc_encode_coding_system[XINT (XPROCESS (proc)->outfd)];
3013 if (! CODING_MAY_REQUIRE_NO_CONVERSION (coding)) 3043 if (CODING_REQUIRE_ENCODING (coding))
3014 { 3044 {
3015 int require = encoding_buffer_size (coding, len); 3045 int require = encoding_buffer_size (coding, len);
3016 int offset, dummy; 3046 int offset, dummy;