diff options
| author | Paul Eggert | 2011-05-02 22:47:50 -0700 |
|---|---|---|
| committer | Paul Eggert | 2011-05-02 22:47:50 -0700 |
| commit | aceeea6c4510002d8fe99b2e6727532ba9cdd8ea (patch) | |
| tree | 2be9fe4b48ca3ba75c93160c03c22889d80b1cad /src | |
| parent | 79f5556a7a75ed21c4fafa04f02adb81822a57f9 (diff) | |
| parent | 256661260dfed952d6497aef73607bfe24795614 (diff) | |
| download | emacs-aceeea6c4510002d8fe99b2e6727532ba9cdd8ea.tar.gz emacs-aceeea6c4510002d8fe99b2e6727532ba9cdd8ea.zip | |
Merge from mainline.
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 34 | ||||
| -rw-r--r-- | src/callproc.c | 367 | ||||
| -rw-r--r-- | src/gnutls.c | 35 | ||||
| -rw-r--r-- | src/lisp.h | 1 | ||||
| -rw-r--r-- | src/sysdep.c | 50 |
5 files changed, 302 insertions, 185 deletions
diff --git a/src/ChangeLog b/src/ChangeLog index 75917224ca9..c237ba24b0f 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -92,6 +92,40 @@ | |||
| 92 | 92 | ||
| 93 | * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long. | 93 | * fns.c (Frandom): Let EMACS_UINT be wider than unsigned long. |
| 94 | 94 | ||
| 95 | 2011-05-02 Juanma Barranquero <lekktu@gmail.com> | ||
| 96 | |||
| 97 | * sysdep.c (get_tty_size) [WINDOWSNT]: Implement. (Bug#8596) | ||
| 98 | |||
| 99 | 2011-05-02 Juanma Barranquero <lekktu@gmail.com> | ||
| 100 | |||
| 101 | * gnutls.c (Qgnutls_log_level, Qgnutls_code, Qgnutls_anon) | ||
| 102 | (Qgnutls_x509pki, Qgnutls_e_interrupted, Qgnutls_e_again) | ||
| 103 | (Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake) | ||
| 104 | (gnutls_global_initialized, Qgnutls_bootprop_priority) | ||
| 105 | (Qgnutls_bootprop_trustfiles, Qgnutls_bootprop_keyfiles) | ||
| 106 | (Qgnutls_bootprop_callbacks, Qgnutls_bootprop_loglevel) | ||
| 107 | (Qgnutls_bootprop_hostname, Qgnutls_bootprop_verify_flags) | ||
| 108 | (Qgnutls_bootprop_verify_error, Qgnutls_bootprop_verify_hostname_error) | ||
| 109 | (Qgnutls_bootprop_callbacks_verify): Make static. | ||
| 110 | |||
| 111 | 2011-05-01 Andreas Schwab <schwab@linux-m68k.org> | ||
| 112 | |||
| 113 | * callproc.c: Indentation fixup. | ||
| 114 | |||
| 115 | * sysdep.c (wait_for_termination_1): Make static. | ||
| 116 | (wait_for_termination, interruptible_wait_for_termination): Move | ||
| 117 | after wait_for_termination_1. | ||
| 118 | |||
| 119 | 2011-05-01 Lars Magne Ingebrigtsen <larsi@gnus.org> | ||
| 120 | |||
| 121 | * sysdep.c (interruptible_wait_for_termination): New function | ||
| 122 | which is like wait_for_termination, but allows keyboard | ||
| 123 | interruptions. | ||
| 124 | |||
| 125 | * callproc.c (Fcall_process): Add (:file "file") as an option for | ||
| 126 | the STDOUT buffer. | ||
| 127 | (Fcall_process_region): Ditto. | ||
| 128 | |||
| 95 | 2011-04-30 Eli Zaretskii <eliz@gnu.org> | 129 | 2011-04-30 Eli Zaretskii <eliz@gnu.org> |
| 96 | 130 | ||
| 97 | * dosfns.c (Fint86, Fdos_memget, Fdos_memput): Use `ASIZE (FOO)' | 131 | * dosfns.c (Fint86, Fdos_memget, Fdos_memput): Use `ASIZE (FOO)' |
diff --git a/src/callproc.c b/src/callproc.c index 3726eb3cc7f..4a29e95b356 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | /* Synchronous subprocess invocation for GNU Emacs. | 1 | /* Synchronous subprocess invocation for GNU Emacs. |
| 2 | Copyright (C) 1985-1988, 1993-1995, 1999-2011 | 2 | Copyright (C) 1985-1988, 1993-1995, 1999-2011 |
| 3 | Free Software Foundation, Inc. | 3 | Free Software Foundation, Inc. |
| 4 | 4 | ||
| 5 | This file is part of GNU Emacs. | 5 | This file is part of GNU Emacs. |
| 6 | 6 | ||
| @@ -156,8 +156,9 @@ DEFUN ("call-process", Fcall_process, Scall_process, 1, MANY, 0, | |||
| 156 | doc: /* Call PROGRAM synchronously in separate process. | 156 | doc: /* Call PROGRAM synchronously in separate process. |
| 157 | The remaining arguments are optional. | 157 | The remaining arguments are optional. |
| 158 | The program's input comes from file INFILE (nil means `/dev/null'). | 158 | The program's input comes from file INFILE (nil means `/dev/null'). |
| 159 | Insert output in BUFFER before point; t means current buffer; | 159 | Insert output in BUFFER before point; t means current buffer; nil for BUFFER |
| 160 | nil for BUFFER means discard it; 0 means discard and don't wait. | 160 | means discard it; 0 means discard and don't wait; and `(:file FILE)', where |
| 161 | FILE is a file name string, means that it should be written to that file. | ||
| 161 | BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, | 162 | BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, |
| 162 | REAL-BUFFER says what to do with standard output, as above, | 163 | REAL-BUFFER says what to do with standard output, as above, |
| 163 | while STDERR-FILE says what to do with standard error in the child. | 164 | while STDERR-FILE says what to do with standard error in the child. |
| @@ -196,14 +197,17 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 196 | /* File to use for stderr in the child. | 197 | /* File to use for stderr in the child. |
| 197 | t means use same as standard output. */ | 198 | t means use same as standard output. */ |
| 198 | Lisp_Object error_file; | 199 | Lisp_Object error_file; |
| 200 | Lisp_Object output_file = Qnil; | ||
| 199 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ | 201 | #ifdef MSDOS /* Demacs 1.1.1 91/10/16 HIRANO Satoshi */ |
| 200 | char *outf, *tempfile; | 202 | char *outf, *tempfile; |
| 201 | int outfilefd; | 203 | int outfilefd; |
| 202 | #endif | 204 | #endif |
| 205 | int fd_output = -1; | ||
| 203 | struct coding_system process_coding; /* coding-system of process output */ | 206 | struct coding_system process_coding; /* coding-system of process output */ |
| 204 | struct coding_system argument_coding; /* coding-system of arguments */ | 207 | struct coding_system argument_coding; /* coding-system of arguments */ |
| 205 | /* Set to the return value of Ffind_operation_coding_system. */ | 208 | /* Set to the return value of Ffind_operation_coding_system. */ |
| 206 | Lisp_Object coding_systems; | 209 | Lisp_Object coding_systems; |
| 210 | int output_to_buffer = 1; | ||
| 207 | 211 | ||
| 208 | /* Qt denotes that Ffind_operation_coding_system is not yet called. */ | 212 | /* Qt denotes that Ffind_operation_coding_system is not yet called. */ |
| 209 | coding_systems = Qt; | 213 | coding_systems = Qt; |
| @@ -273,9 +277,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 273 | { | 277 | { |
| 274 | buffer = args[2]; | 278 | buffer = args[2]; |
| 275 | 279 | ||
| 276 | /* If BUFFER is a list, its meaning is | 280 | /* If BUFFER is a list, its meaning is (BUFFER-FOR-STDOUT |
| 277 | (BUFFER-FOR-STDOUT FILE-FOR-STDERR). */ | 281 | FILE-FOR-STDERR), unless the first element is :file, in which case see |
| 278 | if (CONSP (buffer)) | 282 | the next paragraph. */ |
| 283 | if (CONSP (buffer) | ||
| 284 | && (! SYMBOLP (XCAR (buffer)) | ||
| 285 | || strcmp (SSDATA (SYMBOL_NAME (XCAR (buffer))), ":file"))) | ||
| 279 | { | 286 | { |
| 280 | if (CONSP (XCDR (buffer))) | 287 | if (CONSP (XCDR (buffer))) |
| 281 | { | 288 | { |
| @@ -291,6 +298,17 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 291 | buffer = XCAR (buffer); | 298 | buffer = XCAR (buffer); |
| 292 | } | 299 | } |
| 293 | 300 | ||
| 301 | /* If the buffer is (still) a list, it might be a (:file "file") spec. */ | ||
| 302 | if (CONSP (buffer) | ||
| 303 | && SYMBOLP (XCAR (buffer)) | ||
| 304 | && ! strcmp (SSDATA (SYMBOL_NAME (XCAR (buffer))), ":file")) | ||
| 305 | { | ||
| 306 | output_file = Fexpand_file_name (XCAR (XCDR (buffer)), | ||
| 307 | BVAR (current_buffer, directory)); | ||
| 308 | CHECK_STRING (output_file); | ||
| 309 | buffer = Qnil; | ||
| 310 | } | ||
| 311 | |||
| 294 | if (!(EQ (buffer, Qnil) | 312 | if (!(EQ (buffer, Qnil) |
| 295 | || EQ (buffer, Qt) | 313 | || EQ (buffer, Qt) |
| 296 | || INTEGERP (buffer))) | 314 | || INTEGERP (buffer))) |
| @@ -318,11 +336,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 318 | protected by the caller, so all we really have to worry about is | 336 | protected by the caller, so all we really have to worry about is |
| 319 | buffer. */ | 337 | buffer. */ |
| 320 | { | 338 | { |
| 321 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 339 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; |
| 322 | 340 | ||
| 323 | current_dir = BVAR (current_buffer, directory); | 341 | current_dir = BVAR (current_buffer, directory); |
| 324 | 342 | ||
| 325 | GCPRO4 (infile, buffer, current_dir, error_file); | 343 | GCPRO5 (infile, buffer, current_dir, error_file, output_file); |
| 326 | 344 | ||
| 327 | current_dir = Funhandled_file_name_directory (current_dir); | 345 | current_dir = Funhandled_file_name_directory (current_dir); |
| 328 | if (NILP (current_dir)) | 346 | if (NILP (current_dir)) |
| @@ -342,6 +360,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 342 | current_dir = ENCODE_FILE (current_dir); | 360 | current_dir = ENCODE_FILE (current_dir); |
| 343 | if (STRINGP (error_file) && STRING_MULTIBYTE (error_file)) | 361 | if (STRINGP (error_file) && STRING_MULTIBYTE (error_file)) |
| 344 | error_file = ENCODE_FILE (error_file); | 362 | error_file = ENCODE_FILE (error_file); |
| 363 | if (STRINGP (output_file) && STRING_MULTIBYTE (output_file)) | ||
| 364 | output_file = ENCODE_FILE (output_file); | ||
| 345 | UNGCPRO; | 365 | UNGCPRO; |
| 346 | } | 366 | } |
| 347 | 367 | ||
| @@ -353,6 +373,26 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 353 | infile = DECODE_FILE (infile); | 373 | infile = DECODE_FILE (infile); |
| 354 | report_file_error ("Opening process input file", Fcons (infile, Qnil)); | 374 | report_file_error ("Opening process input file", Fcons (infile, Qnil)); |
| 355 | } | 375 | } |
| 376 | |||
| 377 | if (STRINGP (output_file)) | ||
| 378 | { | ||
| 379 | #ifdef DOS_NT | ||
| 380 | fd_output = emacs_open (SSDATA (output_file), | ||
| 381 | O_WRONLY | O_TRUNC | O_CREAT | O_TEXT, | ||
| 382 | S_IREAD | S_IWRITE); | ||
| 383 | #else /* not DOS_NT */ | ||
| 384 | fd_output = creat (SSDATA (output_file), 0666); | ||
| 385 | #endif /* not DOS_NT */ | ||
| 386 | if (fd_output < 0) | ||
| 387 | { | ||
| 388 | output_file = DECODE_FILE (output_file); | ||
| 389 | report_file_error ("Opening process output file", | ||
| 390 | Fcons (output_file, Qnil)); | ||
| 391 | } | ||
| 392 | if (STRINGP (error_file) || NILP (error_file)) | ||
| 393 | output_to_buffer = 0; | ||
| 394 | } | ||
| 395 | |||
| 356 | /* Search for program; barf if not found. */ | 396 | /* Search for program; barf if not found. */ |
| 357 | { | 397 | { |
| 358 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; | 398 | struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; |
| @@ -413,13 +453,18 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 413 | strcat (tempfile, "detmp.XXX"); | 453 | strcat (tempfile, "detmp.XXX"); |
| 414 | mktemp (tempfile); | 454 | mktemp (tempfile); |
| 415 | 455 | ||
| 416 | outfilefd = creat (tempfile, S_IREAD | S_IWRITE); | 456 | /* If we're redirecting STDOUT to a file, this is already opened. */ |
| 417 | if (outfilefd < 0) | 457 | if (fd_output < 0) |
| 418 | { | 458 | { |
| 419 | emacs_close (filefd); | 459 | outfilefd = creat (tempfile, S_IREAD | S_IWRITE); |
| 420 | report_file_error ("Opening process output file", | 460 | if (outfilefd < 0) { |
| 421 | Fcons (build_string (tempfile), Qnil)); | 461 | emacs_close (filefd); |
| 462 | report_file_error ("Opening process output file", | ||
| 463 | Fcons (build_string (tempfile), Qnil)); | ||
| 464 | } | ||
| 422 | } | 465 | } |
| 466 | else | ||
| 467 | outfilefd = fd_output; | ||
| 423 | fd[0] = filefd; | 468 | fd[0] = filefd; |
| 424 | fd[1] = outfilefd; | 469 | fd[1] = outfilefd; |
| 425 | #endif /* MSDOS */ | 470 | #endif /* MSDOS */ |
| @@ -450,6 +495,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 450 | struct sigaction sigpipe_action; | 495 | struct sigaction sigpipe_action; |
| 451 | #endif | 496 | #endif |
| 452 | 497 | ||
| 498 | if (fd_output >= 0) | ||
| 499 | fd1 = fd_output; | ||
| 453 | #if 0 /* Some systems don't have sigblock. */ | 500 | #if 0 /* Some systems don't have sigblock. */ |
| 454 | mask = sigblock (sigmask (SIGCHLD)); | 501 | mask = sigblock (sigmask (SIGCHLD)); |
| 455 | #endif | 502 | #endif |
| @@ -552,12 +599,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 552 | if (fd[0] >= 0) | 599 | if (fd[0] >= 0) |
| 553 | emacs_close (fd[0]); | 600 | emacs_close (fd[0]); |
| 554 | #ifdef HAVE_SETSID | 601 | #ifdef HAVE_SETSID |
| 555 | setsid (); | 602 | setsid (); |
| 556 | #endif | 603 | #endif |
| 557 | #if defined (USG) | 604 | #if defined (USG) |
| 558 | setpgrp (); | 605 | setpgrp (); |
| 559 | #else | 606 | #else |
| 560 | setpgrp (pid, pid); | 607 | setpgrp (pid, pid); |
| 561 | #endif /* USG */ | 608 | #endif /* USG */ |
| 562 | 609 | ||
| 563 | /* GConf causes us to ignore SIGPIPE, make sure it is restored | 610 | /* GConf causes us to ignore SIGPIPE, make sure it is restored |
| @@ -591,6 +638,8 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 591 | /* Close most of our fd's, but not fd[0] | 638 | /* Close most of our fd's, but not fd[0] |
| 592 | since we will use that to read input from. */ | 639 | since we will use that to read input from. */ |
| 593 | emacs_close (filefd); | 640 | emacs_close (filefd); |
| 641 | if (fd_output >= 0) | ||
| 642 | emacs_close (fd_output); | ||
| 594 | if (fd1 >= 0 && fd1 != fd_error) | 643 | if (fd1 >= 0 && fd1 != fd_error) |
| 595 | emacs_close (fd1); | 644 | emacs_close (fd1); |
| 596 | } | 645 | } |
| @@ -673,136 +722,140 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 673 | immediate_quit = 1; | 722 | immediate_quit = 1; |
| 674 | QUIT; | 723 | QUIT; |
| 675 | 724 | ||
| 676 | { | 725 | if (output_to_buffer) |
| 677 | register EMACS_INT nread; | 726 | { |
| 678 | int first = 1; | 727 | register EMACS_INT nread; |
| 679 | EMACS_INT total_read = 0; | 728 | int first = 1; |
| 680 | int carryover = 0; | 729 | EMACS_INT total_read = 0; |
| 681 | int display_p = display_p_volatile; | 730 | int carryover = 0; |
| 682 | int display_on_the_fly = display_p; | 731 | int display_p = display_p_volatile; |
| 683 | struct coding_system saved_coding; | 732 | int display_on_the_fly = display_p; |
| 684 | 733 | struct coding_system saved_coding; | |
| 685 | saved_coding = process_coding; | 734 | |
| 686 | while (1) | 735 | saved_coding = process_coding; |
| 687 | { | 736 | while (1) |
| 688 | /* Repeatedly read until we've filled as much as possible | 737 | { |
| 689 | of the buffer size we have. But don't read | 738 | /* Repeatedly read until we've filled as much as possible |
| 690 | less than 1024--save that for the next bufferful. */ | 739 | of the buffer size we have. But don't read |
| 691 | nread = carryover; | 740 | less than 1024--save that for the next bufferful. */ |
| 692 | while (nread < bufsize - 1024) | 741 | nread = carryover; |
| 693 | { | 742 | while (nread < bufsize - 1024) |
| 694 | int this_read = emacs_read (fd[0], buf + nread, | 743 | { |
| 695 | bufsize - nread); | 744 | int this_read = emacs_read (fd[0], buf + nread, |
| 745 | bufsize - nread); | ||
| 696 | 746 | ||
| 697 | if (this_read < 0) | 747 | if (this_read < 0) |
| 698 | goto give_up; | 748 | goto give_up; |
| 699 | 749 | ||
| 700 | if (this_read == 0) | 750 | if (this_read == 0) |
| 701 | { | 751 | { |
| 702 | process_coding.mode |= CODING_MODE_LAST_BLOCK; | 752 | process_coding.mode |= CODING_MODE_LAST_BLOCK; |
| 703 | break; | 753 | break; |
| 704 | } | 754 | } |
| 705 | 755 | ||
| 706 | nread += this_read; | 756 | nread += this_read; |
| 707 | total_read += this_read; | 757 | total_read += this_read; |
| 708 | 758 | ||
| 709 | if (display_on_the_fly) | 759 | if (display_on_the_fly) |
| 710 | break; | 760 | break; |
| 711 | } | 761 | } |
| 712 | 762 | ||
| 713 | /* Now NREAD is the total amount of data in the buffer. */ | 763 | /* Now NREAD is the total amount of data in the buffer. */ |
| 714 | immediate_quit = 0; | 764 | immediate_quit = 0; |
| 715 | 765 | ||
| 716 | if (!NILP (buffer)) | 766 | if (!NILP (buffer)) |
| 717 | { | 767 | { |
| 718 | if (NILP (BVAR (current_buffer, enable_multibyte_characters)) | 768 | if (NILP (BVAR (current_buffer, enable_multibyte_characters)) |
| 719 | && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) | 769 | && ! CODING_MAY_REQUIRE_DECODING (&process_coding)) |
| 720 | insert_1_both (buf, nread, nread, 0, 1, 0); | 770 | insert_1_both (buf, nread, nread, 0, 1, 0); |
| 721 | else | 771 | else |
| 722 | { /* We have to decode the input. */ | 772 | { /* We have to decode the input. */ |
| 723 | Lisp_Object curbuf; | 773 | Lisp_Object curbuf; |
| 724 | int count1 = SPECPDL_INDEX (); | 774 | int count1 = SPECPDL_INDEX (); |
| 725 | 775 | ||
| 726 | XSETBUFFER (curbuf, current_buffer); | 776 | XSETBUFFER (curbuf, current_buffer); |
| 727 | /* We cannot allow after-change-functions be run | 777 | /* We cannot allow after-change-functions be run |
| 728 | during decoding, because that might modify the | 778 | during decoding, because that might modify the |
| 729 | buffer, while we rely on process_coding.produced to | 779 | buffer, while we rely on process_coding.produced to |
| 730 | faithfully reflect inserted text until we | 780 | faithfully reflect inserted text until we |
| 731 | TEMP_SET_PT_BOTH below. */ | 781 | TEMP_SET_PT_BOTH below. */ |
| 732 | specbind (Qinhibit_modification_hooks, Qt); | 782 | specbind (Qinhibit_modification_hooks, Qt); |
| 733 | decode_coding_c_string (&process_coding, (unsigned char *) buf, | 783 | decode_coding_c_string (&process_coding, |
| 734 | nread, curbuf); | 784 | (unsigned char *) buf, nread, curbuf); |
| 735 | unbind_to (count1, Qnil); | 785 | unbind_to (count1, Qnil); |
| 736 | if (display_on_the_fly | 786 | if (display_on_the_fly |
| 737 | && CODING_REQUIRE_DETECTION (&saved_coding) | 787 | && CODING_REQUIRE_DETECTION (&saved_coding) |
| 738 | && ! CODING_REQUIRE_DETECTION (&process_coding)) | 788 | && ! CODING_REQUIRE_DETECTION (&process_coding)) |
| 739 | { | 789 | { |
| 740 | /* We have detected some coding system. But, | 790 | /* We have detected some coding system. But, |
| 741 | there's a possibility that the detection was | 791 | there's a possibility that the detection was |
| 742 | done by insufficient data. So, we give up | 792 | done by insufficient data. So, we give up |
| 743 | displaying on the fly. */ | 793 | displaying on the fly. */ |
| 744 | if (process_coding.produced > 0) | 794 | if (process_coding.produced > 0) |
| 745 | del_range_2 (process_coding.dst_pos, | 795 | del_range_2 (process_coding.dst_pos, |
| 746 | process_coding.dst_pos_byte, | 796 | process_coding.dst_pos_byte, |
| 747 | process_coding.dst_pos | 797 | process_coding.dst_pos |
| 748 | + process_coding.produced_char, | 798 | + process_coding.produced_char, |
| 749 | process_coding.dst_pos_byte | 799 | process_coding.dst_pos_byte |
| 750 | + process_coding.produced, 0); | 800 | + process_coding.produced, 0); |
| 751 | display_on_the_fly = 0; | 801 | display_on_the_fly = 0; |
| 752 | process_coding = saved_coding; | 802 | process_coding = saved_coding; |
| 753 | carryover = nread; | 803 | carryover = nread; |
| 754 | /* This is to make the above condition always | 804 | /* This is to make the above condition always |
| 755 | fails in the future. */ | 805 | fails in the future. */ |
| 756 | saved_coding.common_flags | 806 | saved_coding.common_flags |
| 757 | &= ~CODING_REQUIRE_DETECTION_MASK; | 807 | &= ~CODING_REQUIRE_DETECTION_MASK; |
| 758 | continue; | 808 | continue; |
| 759 | } | 809 | } |
| 760 | 810 | ||
| 761 | TEMP_SET_PT_BOTH (PT + process_coding.produced_char, | 811 | TEMP_SET_PT_BOTH (PT + process_coding.produced_char, |
| 762 | PT_BYTE + process_coding.produced); | 812 | PT_BYTE + process_coding.produced); |
| 763 | carryover = process_coding.carryover_bytes; | 813 | carryover = process_coding.carryover_bytes; |
| 764 | if (carryover > 0) | 814 | if (carryover > 0) |
| 765 | memcpy (buf, process_coding.carryover, | 815 | memcpy (buf, process_coding.carryover, |
| 766 | process_coding.carryover_bytes); | 816 | process_coding.carryover_bytes); |
| 767 | } | 817 | } |
| 768 | } | 818 | } |
| 769 | 819 | ||
| 770 | if (process_coding.mode & CODING_MODE_LAST_BLOCK) | 820 | if (process_coding.mode & CODING_MODE_LAST_BLOCK) |
| 771 | break; | 821 | break; |
| 772 | 822 | ||
| 773 | /* Make the buffer bigger as we continue to read more data, | 823 | /* Make the buffer bigger as we continue to read more data, |
| 774 | but not past CALLPROC_BUFFER_SIZE_MAX. */ | 824 | but not past CALLPROC_BUFFER_SIZE_MAX. */ |
| 775 | if (bufsize < CALLPROC_BUFFER_SIZE_MAX && total_read > 32 * bufsize) | 825 | if (bufsize < CALLPROC_BUFFER_SIZE_MAX && total_read > 32 * bufsize) |
| 776 | if ((bufsize *= 2) > CALLPROC_BUFFER_SIZE_MAX) | 826 | if ((bufsize *= 2) > CALLPROC_BUFFER_SIZE_MAX) |
| 777 | bufsize = CALLPROC_BUFFER_SIZE_MAX; | 827 | bufsize = CALLPROC_BUFFER_SIZE_MAX; |
| 778 | 828 | ||
| 779 | if (display_p) | 829 | if (display_p) |
| 780 | { | 830 | { |
| 781 | if (first) | 831 | if (first) |
| 782 | prepare_menu_bars (); | 832 | prepare_menu_bars (); |
| 783 | first = 0; | 833 | first = 0; |
| 784 | redisplay_preserve_echo_area (1); | 834 | redisplay_preserve_echo_area (1); |
| 785 | /* This variable might have been set to 0 for code | 835 | /* This variable might have been set to 0 for code |
| 786 | detection. In that case, we set it back to 1 because | 836 | detection. In that case, we set it back to 1 because |
| 787 | we should have already detected a coding system. */ | 837 | we should have already detected a coding system. */ |
| 788 | display_on_the_fly = 1; | 838 | display_on_the_fly = 1; |
| 789 | } | 839 | } |
| 790 | immediate_quit = 1; | 840 | immediate_quit = 1; |
| 791 | QUIT; | 841 | QUIT; |
| 792 | } | 842 | } |
| 793 | give_up: ; | 843 | give_up: ; |
| 794 | 844 | ||
| 795 | Vlast_coding_system_used = CODING_ID_NAME (process_coding.id); | 845 | Vlast_coding_system_used = CODING_ID_NAME (process_coding.id); |
| 796 | /* If the caller required, let the buffer inherit the | 846 | /* If the caller required, let the buffer inherit the |
| 797 | coding-system used to decode the process output. */ | 847 | coding-system used to decode the process output. */ |
| 798 | if (inherit_process_coding_system) | 848 | if (inherit_process_coding_system) |
| 799 | call1 (intern ("after-insert-file-set-buffer-file-coding-system"), | 849 | call1 (intern ("after-insert-file-set-buffer-file-coding-system"), |
| 800 | make_number (total_read)); | 850 | make_number (total_read)); |
| 801 | } | 851 | } |
| 802 | 852 | ||
| 803 | #ifndef MSDOS | 853 | #ifndef MSDOS |
| 804 | /* Wait for it to terminate, unless it already has. */ | 854 | /* Wait for it to terminate, unless it already has. */ |
| 805 | wait_for_termination (pid); | 855 | if (output_to_buffer) |
| 856 | wait_for_termination (pid); | ||
| 857 | else | ||
| 858 | interruptible_wait_for_termination (pid); | ||
| 806 | #endif | 859 | #endif |
| 807 | 860 | ||
| 808 | immediate_quit = 0; | 861 | immediate_quit = 0; |
| @@ -822,7 +875,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 822 | signame = strsignal (synch_process_termsig); | 875 | signame = strsignal (synch_process_termsig); |
| 823 | 876 | ||
| 824 | if (signame == 0) | 877 | if (signame == 0) |
| 825 | signame = "unknown"; | 878 | signame = "unknown"; |
| 826 | 879 | ||
| 827 | synch_process_death = signame; | 880 | synch_process_death = signame; |
| 828 | } | 881 | } |
| @@ -850,8 +903,10 @@ DEFUN ("call-process-region", Fcall_process_region, Scall_process_region, | |||
| 850 | The remaining arguments are optional. | 903 | The remaining arguments are optional. |
| 851 | Delete the text if fourth arg DELETE is non-nil. | 904 | Delete the text if fourth arg DELETE is non-nil. |
| 852 | 905 | ||
| 853 | Insert output in BUFFER before point; t means current buffer; | 906 | Insert output in BUFFER before point; t means current buffer; nil for |
| 854 | nil for BUFFER means discard it; 0 means discard and don't wait. | 907 | BUFFER means discard it; 0 means discard and don't wait; and `(:file |
| 908 | FILE)', where FILE is a file name string, means that it should be | ||
| 909 | written to that file. | ||
| 855 | BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, | 910 | BUFFER can also have the form (REAL-BUFFER STDERR-FILE); in that case, |
| 856 | REAL-BUFFER says what to do with standard output, as above, | 911 | REAL-BUFFER says what to do with standard output, as above, |
| 857 | while STDERR-FILE says what to do with standard error in the child. | 912 | while STDERR-FILE says what to do with standard error in the child. |
| @@ -1003,18 +1058,18 @@ add_env (char **env, char **new_env, char *string) | |||
| 1003 | { | 1058 | { |
| 1004 | char *p = *ep, *q = string; | 1059 | char *p = *ep, *q = string; |
| 1005 | while (ok) | 1060 | while (ok) |
| 1006 | { | 1061 | { |
| 1007 | if (*q != *p) | 1062 | if (*q != *p) |
| 1008 | break; | 1063 | break; |
| 1009 | if (*q == 0) | 1064 | if (*q == 0) |
| 1010 | /* The string is a lone variable name; keep it for now, we | 1065 | /* The string is a lone variable name; keep it for now, we |
| 1011 | will remove it later. It is a placeholder for a | 1066 | will remove it later. It is a placeholder for a |
| 1012 | variable that is not to be included in the environment. */ | 1067 | variable that is not to be included in the environment. */ |
| 1013 | break; | 1068 | break; |
| 1014 | if (*q == '=') | 1069 | if (*q == '=') |
| 1015 | ok = 0; | 1070 | ok = 0; |
| 1016 | p++, q++; | 1071 | p++, q++; |
| 1017 | } | 1072 | } |
| 1018 | } | 1073 | } |
| 1019 | if (ok) | 1074 | if (ok) |
| 1020 | *new_env++ = string; | 1075 | *new_env++ = string; |
| @@ -1118,8 +1173,8 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1118 | new_length = 0; | 1173 | new_length = 0; |
| 1119 | 1174 | ||
| 1120 | for (tem = Vprocess_environment; | 1175 | for (tem = Vprocess_environment; |
| 1121 | CONSP (tem) && STRINGP (XCAR (tem)); | 1176 | CONSP (tem) && STRINGP (XCAR (tem)); |
| 1122 | tem = XCDR (tem)) | 1177 | tem = XCDR (tem)) |
| 1123 | { | 1178 | { |
| 1124 | if (strncmp (SSDATA (XCAR (tem)), "DISPLAY", 7) == 0 | 1179 | if (strncmp (SSDATA (XCAR (tem)), "DISPLAY", 7) == 0 |
| 1125 | && (SDATA (XCAR (tem)) [7] == '\0' | 1180 | && (SDATA (XCAR (tem)) [7] == '\0' |
| @@ -1172,11 +1227,11 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L | |||
| 1172 | p = q = env; | 1227 | p = q = env; |
| 1173 | while (*p != 0) | 1228 | while (*p != 0) |
| 1174 | { | 1229 | { |
| 1175 | while (*q != 0 && strchr (*q, '=') == NULL) | 1230 | while (*q != 0 && strchr (*q, '=') == NULL) |
| 1176 | q++; | 1231 | q++; |
| 1177 | *p = *q++; | 1232 | *p = *q++; |
| 1178 | if (*p != 0) | 1233 | if (*p != 0) |
| 1179 | p++; | 1234 | p++; |
| 1180 | } | 1235 | } |
| 1181 | } | 1236 | } |
| 1182 | 1237 | ||
diff --git a/src/gnutls.c b/src/gnutls.c index 16a459bd62f..8e41be20505 100644 --- a/src/gnutls.c +++ b/src/gnutls.c | |||
| @@ -34,26 +34,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 34 | static int | 34 | static int |
| 35 | emacs_gnutls_handle_error (gnutls_session_t, int err); | 35 | emacs_gnutls_handle_error (gnutls_session_t, int err); |
| 36 | 36 | ||
| 37 | Lisp_Object Qgnutls_log_level; | 37 | static Lisp_Object Qgnutls_log_level; |
| 38 | Lisp_Object Qgnutls_code; | 38 | static Lisp_Object Qgnutls_code; |
| 39 | Lisp_Object Qgnutls_anon, Qgnutls_x509pki; | 39 | static Lisp_Object Qgnutls_anon, Qgnutls_x509pki; |
| 40 | Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again, | 40 | static Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again, |
| 41 | Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake; | 41 | Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake; |
| 42 | int gnutls_global_initialized; | 42 | static int gnutls_global_initialized; |
| 43 | 43 | ||
| 44 | /* The following are for the property list of `gnutls-boot'. */ | 44 | /* The following are for the property list of `gnutls-boot'. */ |
| 45 | Lisp_Object Qgnutls_bootprop_priority; | 45 | static Lisp_Object Qgnutls_bootprop_priority; |
| 46 | Lisp_Object Qgnutls_bootprop_trustfiles; | 46 | static Lisp_Object Qgnutls_bootprop_trustfiles; |
| 47 | Lisp_Object Qgnutls_bootprop_keyfiles; | 47 | static Lisp_Object Qgnutls_bootprop_keyfiles; |
| 48 | Lisp_Object Qgnutls_bootprop_callbacks; | 48 | static Lisp_Object Qgnutls_bootprop_callbacks; |
| 49 | Lisp_Object Qgnutls_bootprop_loglevel; | 49 | static Lisp_Object Qgnutls_bootprop_loglevel; |
| 50 | Lisp_Object Qgnutls_bootprop_hostname; | 50 | static Lisp_Object Qgnutls_bootprop_hostname; |
| 51 | Lisp_Object Qgnutls_bootprop_verify_flags; | 51 | static Lisp_Object Qgnutls_bootprop_verify_flags; |
| 52 | Lisp_Object Qgnutls_bootprop_verify_error; | 52 | static Lisp_Object Qgnutls_bootprop_verify_error; |
| 53 | Lisp_Object Qgnutls_bootprop_verify_hostname_error; | 53 | static Lisp_Object Qgnutls_bootprop_verify_hostname_error; |
| 54 | 54 | ||
| 55 | /* Callback keys for `gnutls-boot'. Unused currently. */ | 55 | /* Callback keys for `gnutls-boot'. Unused currently. */ |
| 56 | Lisp_Object Qgnutls_bootprop_callbacks_verify; | 56 | static Lisp_Object Qgnutls_bootprop_callbacks_verify; |
| 57 | 57 | ||
| 58 | static void | 58 | static void |
| 59 | gnutls_log_function (int level, const char* string) | 59 | gnutls_log_function (int level, const char* string) |
| @@ -490,7 +490,7 @@ one trustfile (usually a CA bundle). */) | |||
| 490 | /* callbacks = Fplist_get (proplist, Qgnutls_bootprop_callbacks); */ | 490 | /* callbacks = Fplist_get (proplist, Qgnutls_bootprop_callbacks); */ |
| 491 | loglevel = Fplist_get (proplist, Qgnutls_bootprop_loglevel); | 491 | loglevel = Fplist_get (proplist, Qgnutls_bootprop_loglevel); |
| 492 | verify_flags = Fplist_get (proplist, Qgnutls_bootprop_verify_flags); | 492 | verify_flags = Fplist_get (proplist, Qgnutls_bootprop_verify_flags); |
| 493 | /* verify_error = Fplist_get (proplist, Qgnutls_bootprop_verify_error); */ | 493 | /* verify_error = Fplist_get (proplist, Qgnutls_bootprop_verify_error); */ |
| 494 | verify_hostname_error = Fplist_get (proplist, Qgnutls_bootprop_verify_hostname_error); | 494 | verify_hostname_error = Fplist_get (proplist, Qgnutls_bootprop_verify_hostname_error); |
| 495 | 495 | ||
| 496 | if (!STRINGP (hostname)) | 496 | if (!STRINGP (hostname)) |
| @@ -918,4 +918,5 @@ syms_of_gnutls (void) | |||
| 918 | defsubr (&Sgnutls_deinit); | 918 | defsubr (&Sgnutls_deinit); |
| 919 | defsubr (&Sgnutls_bye); | 919 | defsubr (&Sgnutls_bye); |
| 920 | } | 920 | } |
| 921 | #endif | 921 | |
| 922 | #endif /* HAVE_GNUTLS */ | ||
diff --git a/src/lisp.h b/src/lisp.h index 76938a49ac4..bb3a8cc393c 100644 --- a/src/lisp.h +++ b/src/lisp.h | |||
| @@ -3349,6 +3349,7 @@ extern void reset_sys_modes (struct tty_display_info *); | |||
| 3349 | extern void init_all_sys_modes (void); | 3349 | extern void init_all_sys_modes (void); |
| 3350 | extern void reset_all_sys_modes (void); | 3350 | extern void reset_all_sys_modes (void); |
| 3351 | extern void wait_for_termination (int); | 3351 | extern void wait_for_termination (int); |
| 3352 | extern void interruptible_wait_for_termination (int); | ||
| 3352 | extern void flush_pending_output (int); | 3353 | extern void flush_pending_output (int); |
| 3353 | extern void child_setup_tty (int); | 3354 | extern void child_setup_tty (int); |
| 3354 | extern void setup_pty (int); | 3355 | extern void setup_pty (int); |
diff --git a/src/sysdep.c b/src/sysdep.c index 43f50cdb0a9..5ad3389dd8f 100644 --- a/src/sysdep.c +++ b/src/sysdep.c | |||
| @@ -296,11 +296,9 @@ init_baud_rate (int fd) | |||
| 296 | int wait_debugging EXTERNALLY_VISIBLE; | 296 | int wait_debugging EXTERNALLY_VISIBLE; |
| 297 | 297 | ||
| 298 | #ifndef MSDOS | 298 | #ifndef MSDOS |
| 299 | /* Wait for subprocess with process id `pid' to terminate and | ||
| 300 | make sure it will get eliminated (not remain forever as a zombie) */ | ||
| 301 | 299 | ||
| 302 | void | 300 | static void |
| 303 | wait_for_termination (int pid) | 301 | wait_for_termination_1 (int pid, int interruptible) |
| 304 | { | 302 | { |
| 305 | while (1) | 303 | while (1) |
| 306 | { | 304 | { |
| @@ -339,9 +337,27 @@ wait_for_termination (int pid) | |||
| 339 | sigsuspend (&empty_mask); | 337 | sigsuspend (&empty_mask); |
| 340 | #endif /* not WINDOWSNT */ | 338 | #endif /* not WINDOWSNT */ |
| 341 | #endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ | 339 | #endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ |
| 340 | if (interruptible) | ||
| 341 | QUIT; | ||
| 342 | } | 342 | } |
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | /* Wait for subprocess with process id `pid' to terminate and | ||
| 346 | make sure it will get eliminated (not remain forever as a zombie) */ | ||
| 347 | |||
| 348 | void | ||
| 349 | wait_for_termination (int pid) | ||
| 350 | { | ||
| 351 | wait_for_termination_1 (pid, 0); | ||
| 352 | } | ||
| 353 | |||
| 354 | /* Like the above, but allow keyboard interruption. */ | ||
| 355 | void | ||
| 356 | interruptible_wait_for_termination (int pid) | ||
| 357 | { | ||
| 358 | wait_for_termination_1 (pid, 1); | ||
| 359 | } | ||
| 360 | |||
| 345 | /* | 361 | /* |
| 346 | * flush any pending output | 362 | * flush any pending output |
| 347 | * (may flush input as well; it does not matter the way we use it) | 363 | * (may flush input as well; it does not matter the way we use it) |
| @@ -1109,8 +1125,7 @@ tabs_safe_p (int fd) | |||
| 1109 | void | 1125 | void |
| 1110 | get_tty_size (int fd, int *widthp, int *heightp) | 1126 | get_tty_size (int fd, int *widthp, int *heightp) |
| 1111 | { | 1127 | { |
| 1112 | 1128 | #if defined TIOCGWINSZ | |
| 1113 | #ifdef TIOCGWINSZ | ||
| 1114 | 1129 | ||
| 1115 | /* BSD-style. */ | 1130 | /* BSD-style. */ |
| 1116 | struct winsize size; | 1131 | struct winsize size; |
| @@ -1123,8 +1138,7 @@ get_tty_size (int fd, int *widthp, int *heightp) | |||
| 1123 | *heightp = size.ws_row; | 1138 | *heightp = size.ws_row; |
| 1124 | } | 1139 | } |
| 1125 | 1140 | ||
| 1126 | #else | 1141 | #elif defined TIOCGSIZE |
| 1127 | #ifdef TIOCGSIZE | ||
| 1128 | 1142 | ||
| 1129 | /* SunOS - style. */ | 1143 | /* SunOS - style. */ |
| 1130 | struct ttysize size; | 1144 | struct ttysize size; |
| @@ -1137,16 +1151,28 @@ get_tty_size (int fd, int *widthp, int *heightp) | |||
| 1137 | *heightp = size.ts_lines; | 1151 | *heightp = size.ts_lines; |
| 1138 | } | 1152 | } |
| 1139 | 1153 | ||
| 1140 | #else | 1154 | #elif defined WINDOWSNT |
| 1141 | #ifdef MSDOS | 1155 | |
| 1156 | CONSOLE_SCREEN_BUFFER_INFO info; | ||
| 1157 | if (GetConsoleScreenBufferInfo (GetStdHandle (STD_OUTPUT_HANDLE), &info)) | ||
| 1158 | { | ||
| 1159 | *widthp = info.srWindow.Right - info.srWindow.Left + 1; | ||
| 1160 | *heightp = info.srWindow.Bottom - info.srWindow.Top + 1; | ||
| 1161 | } | ||
| 1162 | else | ||
| 1163 | *widthp = *heightp = 0; | ||
| 1164 | |||
| 1165 | #elif defined MSDOS | ||
| 1166 | |||
| 1142 | *widthp = ScreenCols (); | 1167 | *widthp = ScreenCols (); |
| 1143 | *heightp = ScreenRows (); | 1168 | *heightp = ScreenRows (); |
| 1169 | |||
| 1144 | #else /* system doesn't know size */ | 1170 | #else /* system doesn't know size */ |
| 1171 | |||
| 1145 | *widthp = 0; | 1172 | *widthp = 0; |
| 1146 | *heightp = 0; | 1173 | *heightp = 0; |
| 1174 | |||
| 1147 | #endif | 1175 | #endif |
| 1148 | #endif /* not SunOS-style */ | ||
| 1149 | #endif /* not BSD-style */ | ||
| 1150 | } | 1176 | } |
| 1151 | 1177 | ||
| 1152 | /* Set the logical window size associated with descriptor FD | 1178 | /* Set the logical window size associated with descriptor FD |