diff options
| author | Joakim Verona | 2012-09-03 17:30:17 +0200 |
|---|---|---|
| committer | Joakim Verona | 2012-09-03 17:30:17 +0200 |
| commit | 4a37733c693d59a9b83a3fb2d0c7f9461d149f60 (patch) | |
| tree | a33402e09342f748baebf0e4f5a1e40538e620f4 /src/callproc.c | |
| parent | 5436d1df5e2ba0b4d4f72b03a1cd09b20403654b (diff) | |
| parent | dcde497f27945c3ca4ce8c21f655ef6f627acdd2 (diff) | |
| download | emacs-4a37733c693d59a9b83a3fb2d0c7f9461d149f60.tar.gz emacs-4a37733c693d59a9b83a3fb2d0c7f9461d149f60.zip | |
upstream
Diffstat (limited to 'src/callproc.c')
| -rw-r--r-- | src/callproc.c | 40 |
1 files changed, 18 insertions, 22 deletions
diff --git a/src/callproc.c b/src/callproc.c index 10a80168fb2..2e9a8950700 100644 --- a/src/callproc.c +++ b/src/callproc.c | |||
| @@ -65,10 +65,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 65 | #include "nsterm.h" | 65 | #include "nsterm.h" |
| 66 | #endif | 66 | #endif |
| 67 | 67 | ||
| 68 | #ifndef USE_CRT_DLL | ||
| 69 | extern char **environ; | ||
| 70 | #endif | ||
| 71 | |||
| 72 | #ifdef HAVE_SETPGID | 68 | #ifdef HAVE_SETPGID |
| 73 | #if !defined (USG) | 69 | #if !defined (USG) |
| 74 | #undef setpgrp | 70 | #undef setpgrp |
| @@ -81,7 +77,7 @@ static Lisp_Object Vtemp_file_name_pattern; | |||
| 81 | 77 | ||
| 82 | /* True if we are about to fork off a synchronous process or if we | 78 | /* True if we are about to fork off a synchronous process or if we |
| 83 | are waiting for it. */ | 79 | are waiting for it. */ |
| 84 | int synch_process_alive; | 80 | bool synch_process_alive; |
| 85 | 81 | ||
| 86 | /* Nonzero => this is a string explaining death of synchronous subprocess. */ | 82 | /* Nonzero => this is a string explaining death of synchronous subprocess. */ |
| 87 | const char *synch_process_death; | 83 | const char *synch_process_death; |
| @@ -98,8 +94,8 @@ int synch_process_retcode; | |||
| 98 | On MSDOS, delete the temporary file on any kind of termination. | 94 | On MSDOS, delete the temporary file on any kind of termination. |
| 99 | On Unix, kill the process and any children on termination by signal. */ | 95 | On Unix, kill the process and any children on termination by signal. */ |
| 100 | 96 | ||
| 101 | /* Nonzero if this is termination due to exit. */ | 97 | /* True if this is termination due to exit. */ |
| 102 | static int call_process_exited; | 98 | static bool call_process_exited; |
| 103 | 99 | ||
| 104 | static Lisp_Object | 100 | static Lisp_Object |
| 105 | call_process_kill (Lisp_Object fdpid) | 101 | call_process_kill (Lisp_Object fdpid) |
| @@ -194,7 +190,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 194 | (ptrdiff_t nargs, Lisp_Object *args) | 190 | (ptrdiff_t nargs, Lisp_Object *args) |
| 195 | { | 191 | { |
| 196 | Lisp_Object infile, buffer, current_dir, path, cleanup_info_tail; | 192 | Lisp_Object infile, buffer, current_dir, path, cleanup_info_tail; |
| 197 | int display_p; | 193 | bool display_p; |
| 198 | int fd[2]; | 194 | int fd[2]; |
| 199 | int filefd; | 195 | int filefd; |
| 200 | #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024) | 196 | #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024) |
| @@ -221,7 +217,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 221 | struct coding_system argument_coding; /* coding-system of arguments */ | 217 | struct coding_system argument_coding; /* coding-system of arguments */ |
| 222 | /* Set to the return value of Ffind_operation_coding_system. */ | 218 | /* Set to the return value of Ffind_operation_coding_system. */ |
| 223 | Lisp_Object coding_systems; | 219 | Lisp_Object coding_systems; |
| 224 | int output_to_buffer = 1; | 220 | bool output_to_buffer = 1; |
| 225 | 221 | ||
| 226 | /* Qt denotes that Ffind_operation_coding_system is not yet called. */ | 222 | /* Qt denotes that Ffind_operation_coding_system is not yet called. */ |
| 227 | coding_systems = Qt; | 223 | coding_systems = Qt; |
| @@ -245,7 +241,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 245 | /* If arguments are supplied, we may have to encode them. */ | 241 | /* If arguments are supplied, we may have to encode them. */ |
| 246 | if (nargs >= 5) | 242 | if (nargs >= 5) |
| 247 | { | 243 | { |
| 248 | int must_encode = 0; | 244 | bool must_encode = 0; |
| 249 | Lisp_Object coding_attrs; | 245 | Lisp_Object coding_attrs; |
| 250 | 246 | ||
| 251 | for (i = 4; i < nargs; i++) | 247 | for (i = 4; i < nargs; i++) |
| @@ -614,12 +610,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 614 | Lisp_Object volatile buffer_volatile = buffer; | 610 | Lisp_Object volatile buffer_volatile = buffer; |
| 615 | Lisp_Object volatile coding_systems_volatile = coding_systems; | 611 | Lisp_Object volatile coding_systems_volatile = coding_systems; |
| 616 | Lisp_Object volatile current_dir_volatile = current_dir; | 612 | Lisp_Object volatile current_dir_volatile = current_dir; |
| 617 | int volatile display_p_volatile = display_p; | 613 | bool volatile display_p_volatile = display_p; |
| 614 | bool volatile output_to_buffer_volatile = output_to_buffer; | ||
| 615 | bool volatile sa_must_free_volatile = sa_must_free; | ||
| 618 | int volatile fd1_volatile = fd1; | 616 | int volatile fd1_volatile = fd1; |
| 619 | int volatile fd_error_volatile = fd_error; | 617 | int volatile fd_error_volatile = fd_error; |
| 620 | int volatile fd_output_volatile = fd_output; | 618 | int volatile fd_output_volatile = fd_output; |
| 621 | int volatile output_to_buffer_volatile = output_to_buffer; | ||
| 622 | int volatile sa_must_free_volatile = sa_must_free; | ||
| 623 | ptrdiff_t volatile sa_count_volatile = sa_count; | 619 | ptrdiff_t volatile sa_count_volatile = sa_count; |
| 624 | unsigned char const **volatile new_argv_volatile = new_argv; | 620 | unsigned char const **volatile new_argv_volatile = new_argv; |
| 625 | 621 | ||
| @@ -770,11 +766,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) | |||
| 770 | 766 | ||
| 771 | if (output_to_buffer) | 767 | if (output_to_buffer) |
| 772 | { | 768 | { |
| 773 | register int nread; | 769 | int nread; |
| 774 | int first = 1; | 770 | bool first = 1; |
| 775 | EMACS_INT total_read = 0; | 771 | EMACS_INT total_read = 0; |
| 776 | int carryover = 0; | 772 | int carryover = 0; |
| 777 | int display_on_the_fly = display_p; | 773 | bool display_on_the_fly = display_p; |
| 778 | struct coding_system saved_coding; | 774 | struct coding_system saved_coding; |
| 779 | 775 | ||
| 780 | saved_coding = process_coding; | 776 | saved_coding = process_coding; |
| @@ -1090,7 +1086,7 @@ static char ** | |||
| 1090 | add_env (char **env, char **new_env, char *string) | 1086 | add_env (char **env, char **new_env, char *string) |
| 1091 | { | 1087 | { |
| 1092 | char **ep; | 1088 | char **ep; |
| 1093 | int ok = 1; | 1089 | bool ok = 1; |
| 1094 | if (string == NULL) | 1090 | if (string == NULL) |
| 1095 | return new_env; | 1091 | return new_env; |
| 1096 | 1092 | ||
| @@ -1130,8 +1126,7 @@ add_env (char **env, char **new_env, char *string) | |||
| 1130 | Therefore, the superior process must save and restore the value | 1126 | Therefore, the superior process must save and restore the value |
| 1131 | of environ around the vfork and the call to this function. | 1127 | of environ around the vfork and the call to this function. |
| 1132 | 1128 | ||
| 1133 | SET_PGRP is nonzero if we should put the subprocess into a separate | 1129 | If SET_PGRP, put the subprocess into a separate process group. |
| 1134 | process group. | ||
| 1135 | 1130 | ||
| 1136 | CURRENT_DIR is an elisp string giving the path of the current | 1131 | CURRENT_DIR is an elisp string giving the path of the current |
| 1137 | directory the subprocess should have. Since we can't really signal | 1132 | directory the subprocess should have. Since we can't really signal |
| @@ -1139,7 +1134,8 @@ add_env (char **env, char **new_env, char *string) | |||
| 1139 | executable directory by the parent. */ | 1134 | executable directory by the parent. */ |
| 1140 | 1135 | ||
| 1141 | int | 1136 | int |
| 1142 | child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, Lisp_Object current_dir) | 1137 | child_setup (int in, int out, int err, char **new_argv, bool set_pgrp, |
| 1138 | Lisp_Object current_dir) | ||
| 1143 | { | 1139 | { |
| 1144 | char **env; | 1140 | char **env; |
| 1145 | char *pwd_var; | 1141 | char *pwd_var; |
| @@ -1398,7 +1394,7 @@ relocate_fd (int fd, int minfd) | |||
| 1398 | } | 1394 | } |
| 1399 | #endif /* not WINDOWSNT */ | 1395 | #endif /* not WINDOWSNT */ |
| 1400 | 1396 | ||
| 1401 | static int | 1397 | static bool |
| 1402 | getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value, | 1398 | getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value, |
| 1403 | ptrdiff_t *valuelen, Lisp_Object env) | 1399 | ptrdiff_t *valuelen, Lisp_Object env) |
| 1404 | { | 1400 | { |
| @@ -1433,7 +1429,7 @@ getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value, | |||
| 1433 | return 0; | 1429 | return 0; |
| 1434 | } | 1430 | } |
| 1435 | 1431 | ||
| 1436 | static int | 1432 | static bool |
| 1437 | getenv_internal (const char *var, ptrdiff_t varlen, char **value, | 1433 | getenv_internal (const char *var, ptrdiff_t varlen, char **value, |
| 1438 | ptrdiff_t *valuelen, Lisp_Object frame) | 1434 | ptrdiff_t *valuelen, Lisp_Object frame) |
| 1439 | { | 1435 | { |