diff options
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/src/callproc.c b/src/callproc.c index 5eba3271358..ea79da7ff5a 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -445,28 +445,34 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 445 | path = Fsubstring (path, make_number (2), Qnil); | 445 | path = Fsubstring (path, make_number (2), Qnil); |
| 446 | 446 | ||
| 447 | new_argv = SAFE_ALLOCA ((nargs > 4 ? nargs - 2 : 2) * sizeof *new_argv); | 447 | new_argv = SAFE_ALLOCA ((nargs > 4 ? nargs - 2 : 2) * sizeof *new_argv); |
| 448 | if (nargs > 4) | ||
| 449 | { | ||
| 450 | ptrdiff_t i; | ||
| 451 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; | ||
| 452 | 448 | ||
| 453 | GCPRO5 (infile, buffer, current_dir, path, error_file); | 449 | { |
| 454 | argument_coding.dst_multibyte = 0; | 450 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 455 | for (i = 4; i < nargs; i++) | 451 | |
| 456 | { | 452 | GCPRO5 (infile, buffer, current_dir, path, error_file); |
| 457 | argument_coding.src_multibyte = STRING_MULTIBYTE (args[i]); | 453 | if (nargs > 4) |
| 458 | if (CODING_REQUIRE_ENCODING (&argument_coding)) | 454 | { |
| 459 | /* We must encode this argument. */ | 455 | ptrdiff_t i; |
| 460 | args[i] = encode_coding_string (&argument_coding, args[i], 1); | 456 | |
| 461 | } | 457 | argument_coding.dst_multibyte = 0; |
| 462 | UNGCPRO; | 458 | for (i = 4; i < nargs; i++) |
| 463 | for (i = 4; i < nargs; i++) | 459 | { |
| 464 | new_argv[i - 3] = SSDATA (args[i]); | 460 | argument_coding.src_multibyte = STRING_MULTIBYTE (args[i]); |
| 465 | new_argv[i - 3] = 0; | 461 | if (CODING_REQUIRE_ENCODING (&argument_coding)) |
| 466 | } | 462 | /* We must encode this argument. */ |
| 467 | else | 463 | args[i] = encode_coding_string (&argument_coding, args[i], 1); |
| 468 | new_argv[1] = 0; | 464 | } |
| 469 | new_argv[0] = SSDATA (path); | 465 | for (i = 4; i < nargs; i++) |
| 466 | new_argv[i - 3] = SSDATA (args[i]); | ||
| 467 | new_argv[i - 3] = 0; | ||
| 468 | } | ||
| 469 | else | ||
| 470 | new_argv[1] = 0; | ||
| 471 | if (STRING_MULTIBYTE (path)) | ||
| 472 | path = ENCODE_FILE (path); | ||
| 473 | new_argv[0] = SSDATA (path); | ||
| 474 | UNGCPRO; | ||
| 475 | } | ||
| 470 | 476 | ||
| 471 | #ifdef MSDOS /* MW, July 1993 */ | 477 | #ifdef MSDOS /* MW, July 1993 */ |
| 472 | 478 | ||
| @@ -481,7 +487,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 481 | tempfile = alloca (20); | 487 | tempfile = alloca (20); |
| 482 | *tempfile = '\0'; | 488 | *tempfile = '\0'; |
| 483 | } | 489 | } |
| 484 | dostounix_filename (tempfile); | 490 | dostounix_filename (tempfile, 0); |
| 485 | if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/') | 491 | if (*tempfile == '\0' || tempfile[strlen (tempfile) - 1] != '/') |
| 486 | strcat (tempfile, "/"); | 492 | strcat (tempfile, "/"); |
| 487 | strcat (tempfile, "detmp.XXX"); | 493 | strcat (tempfile, "detmp.XXX"); |