diff options
| author | Kenichi Handa | 1999-12-15 00:02:12 +0000 |
|---|---|---|
| committer | Kenichi Handa | 1999-12-15 00:02:12 +0000 |
| commit | bca78757c13cd8d0dc5c166388f8377949d73bac (patch) | |
| tree | 82fcbd0d56734c4393028abbe38805b2bcfe4173 /src | |
| parent | c80329d154ec98d764262f1dc31188eabbb44a2c (diff) | |
| download | emacs-bca78757c13cd8d0dc5c166388f8377949d73bac.tar.gz emacs-bca78757c13cd8d0dc5c166388f8377949d73bac.zip | |
(Fcall_process): Call code_convert_string to encode
arguments. Use CODING_REQUIRE_DECODING to check if the process
output should be decoded.
Diffstat (limited to 'src')
| -rw-r--r-- | src/callproc.c | 41 |
1 files changed, 12 insertions, 29 deletions
diff --git a/src/callproc.c b/src/callproc.c index e1d40b35055..85a5eaf72d9 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -380,12 +380,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 380 | { | 380 | { |
| 381 | register int i; | 381 | register int i; |
| 382 | 382 | ||
| 383 | if (! CODING_REQUIRE_ENCODING (&argument_coding)) | 383 | if (CODING_REQUIRE_ENCODING (&argument_coding)) |
| 384 | { | ||
| 385 | for (i = 4; i < nargs; i++) | ||
| 386 | new_argv[i - 3] = XSTRING (args[i])->data; | ||
| 387 | } | ||
| 388 | else | ||
| 389 | { | 384 | { |
| 390 | /* We must encode the arguments. */ | 385 | /* We must encode the arguments. */ |
| 391 | struct gcpro gcpro1, gcpro2, gcpro3; | 386 | struct gcpro gcpro1, gcpro2, gcpro3; |
| @@ -393,25 +388,13 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 393 | GCPRO3 (infile, buffer, current_dir); | 388 | GCPRO3 (infile, buffer, current_dir); |
| 394 | for (i = 4; i < nargs; i++) | 389 | for (i = 4; i < nargs; i++) |
| 395 | { | 390 | { |
| 396 | int size = encoding_buffer_size (&argument_coding, | 391 | args[i] = code_convert_string (args[i], &argument_coding, 1, 0); |
| 397 | STRING_BYTES (XSTRING (args[i]))); | 392 | setup_ccl_program (&(argument_coding.spec.ccl.encoder), Qnil); |
| 398 | unsigned char *dummy1 = (unsigned char *) alloca (size); | ||
| 399 | |||
| 400 | /* The Irix 4.0 compiler barfs if we eliminate dummy. */ | ||
| 401 | new_argv[i - 3] = dummy1; | ||
| 402 | argument_coding.mode |= CODING_MODE_LAST_BLOCK; | ||
| 403 | encode_coding (&argument_coding, | ||
| 404 | XSTRING (args[i])->data, | ||
| 405 | new_argv[i - 3], | ||
| 406 | STRING_BYTES (XSTRING (args[i])), | ||
| 407 | size); | ||
| 408 | new_argv[i - 3][argument_coding.produced] = 0; | ||
| 409 | /* We have to initialize CCL program status again. */ | ||
| 410 | if (argument_coding.type == coding_type_ccl) | ||
| 411 | setup_ccl_program (&(argument_coding.spec.ccl.encoder), Qnil); | ||
| 412 | } | 393 | } |
| 413 | UNGCPRO; | 394 | UNGCPRO; |
| 414 | } | 395 | } |
| 396 | for (i = 4; i < nargs; i++) | ||
| 397 | new_argv[i - 3] = XSTRING (args[i])->data; | ||
| 415 | new_argv[nargs - 3] = 0; | 398 | new_argv[nargs - 3] = 0; |
| 416 | } | 399 | } |
| 417 | else | 400 | else |
| @@ -765,7 +748,7 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 765 | 748 | ||
| 766 | if (!NILP (buffer)) | 749 | if (!NILP (buffer)) |
| 767 | { | 750 | { |
| 768 | if (process_coding.type == coding_type_no_conversion) | 751 | if (! CODING_REQUIRE_DECODING (&process_coding)) |
| 769 | insert (bufptr, nread); | 752 | insert (bufptr, nread); |
| 770 | else | 753 | else |
| 771 | { /* We have to decode the input. */ | 754 | { /* We have to decode the input. */ |
| @@ -831,13 +814,13 @@ If you quit, the process is killed with SIGINT, or SIGKILL if you quit again.") | |||
| 831 | } | 814 | } |
| 832 | give_up: ; | 815 | give_up: ; |
| 833 | 816 | ||
| 834 | Vlast_coding_system_used = process_coding.symbol; | 817 | Vlast_coding_system_used = process_coding.symbol; |
| 835 | 818 | ||
| 836 | /* If the caller required, let the buffer inherit the | 819 | /* If the caller required, let the buffer inherit the |
| 837 | coding-system used to decode the process output. */ | 820 | coding-system used to decode the process output. */ |
| 838 | if (inherit_process_coding_system) | 821 | if (inherit_process_coding_system) |
| 839 | call1 (intern ("after-insert-file-set-buffer-file-coding-system"), | 822 | call1 (intern ("after-insert-file-set-buffer-file-coding-system"), |
| 840 | make_number (total_read)); | 823 | make_number (total_read)); |
| 841 | } | 824 | } |
| 842 | 825 | ||
| 843 | /* Wait for it to terminate, unless it already has. */ | 826 | /* Wait for it to terminate, unless it already has. */ |