Commit 19ed11ba authored by Andreas Schwab's avatar Andreas Schwab
Browse files

* src/callproc.c: Indentation fixup.

parent e7a6747f
2011-05-01 Andreas Schwab <schwab@linux-m68k.org> 2011-05-01 Andreas Schwab <schwab@linux-m68k.org>
* callproc.c: Indentation fixup.
* sysdep.c (wait_for_termination_1): Make static. * sysdep.c (wait_for_termination_1): Make static.
(wait_for_termination, interruptible_wait_for_termination): Move (wait_for_termination, interruptible_wait_for_termination): Move
after wait_for_termination_1. after wait_for_termination_1.
......
/* Synchronous subprocess invocation for GNU Emacs. /* Synchronous subprocess invocation for GNU Emacs.
Copyright (C) 1985-1988, 1993-1995, 1999-2011 Copyright (C) 1985-1988, 1993-1995, 1999-2011
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GNU Emacs. This file is part of GNU Emacs.
...@@ -280,9 +280,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -280,9 +280,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
/* If BUFFER is a list, its meaning is (BUFFER-FOR-STDOUT /* If BUFFER is a list, its meaning is (BUFFER-FOR-STDOUT
FILE-FOR-STDERR), unless the first element is :file, in which case see FILE-FOR-STDERR), unless the first element is :file, in which case see
the next paragraph. */ the next paragraph. */
if (CONSP (buffer) && if (CONSP (buffer)
(! SYMBOLP (XCAR (buffer)) || && (! SYMBOLP (XCAR (buffer))
strcmp (SSDATA (SYMBOL_NAME (XCAR (buffer))), ":file"))) || strcmp (SSDATA (SYMBOL_NAME (XCAR (buffer))), ":file")))
{ {
if (CONSP (XCDR (buffer))) if (CONSP (XCDR (buffer)))
{ {
...@@ -299,9 +299,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -299,9 +299,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
} }
/* If the buffer is (still) a list, it might be a (:file "file") spec. */ /* If the buffer is (still) a list, it might be a (:file "file") spec. */
if (CONSP (buffer) && if (CONSP (buffer)
SYMBOLP (XCAR (buffer)) && && SYMBOLP (XCAR (buffer))
! strcmp (SSDATA (SYMBOL_NAME (XCAR (buffer))), ":file")) && ! strcmp (SSDATA (SYMBOL_NAME (XCAR (buffer))), ":file"))
{ {
output_file = Fexpand_file_name (XCAR (XCDR (buffer)), output_file = Fexpand_file_name (XCAR (XCDR (buffer)),
BVAR (current_buffer, directory)); BVAR (current_buffer, directory));
...@@ -388,9 +388,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -388,9 +388,9 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
output_file = DECODE_FILE (output_file); output_file = DECODE_FILE (output_file);
report_file_error ("Opening process output file", report_file_error ("Opening process output file",
Fcons (output_file, Qnil)); Fcons (output_file, Qnil));
} }
if (STRINGP (error_file) || NILP (error_file)) if (STRINGP (error_file) || NILP (error_file))
output_to_buffer = 0; output_to_buffer = 0;
} }
/* Search for program; barf if not found. */ /* Search for program; barf if not found. */
...@@ -599,12 +599,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -599,12 +599,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
if (fd[0] >= 0) if (fd[0] >= 0)
emacs_close (fd[0]); emacs_close (fd[0]);
#ifdef HAVE_SETSID #ifdef HAVE_SETSID
setsid (); setsid ();
#endif #endif
#if defined (USG) #if defined (USG)
setpgrp (); setpgrp ();
#else #else
setpgrp (pid, pid); setpgrp (pid, pid);
#endif /* USG */ #endif /* USG */
/* GConf causes us to ignore SIGPIPE, make sure it is restored /* GConf causes us to ignore SIGPIPE, make sure it is restored
...@@ -723,132 +723,132 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -723,132 +723,132 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
QUIT; QUIT;
if (output_to_buffer) if (output_to_buffer)
{ {
register EMACS_INT nread; register EMACS_INT nread;
int first = 1; int first = 1;
EMACS_INT total_read = 0; EMACS_INT total_read = 0;
int carryover = 0; int carryover = 0;
int display_p = display_p_volatile; int display_p = display_p_volatile;
int display_on_the_fly = display_p; int display_on_the_fly = display_p;
struct coding_system saved_coding; struct coding_system saved_coding;
saved_coding = process_coding; saved_coding = process_coding;
while (1) while (1)
{ {
/* Repeatedly read until we've filled as much as possible /* Repeatedly read until we've filled as much as possible
of the buffer size we have. But don't read of the buffer size we have. But don't read
less than 1024--save that for the next bufferful. */ less than 1024--save that for the next bufferful. */
nread = carryover; nread = carryover;
while (nread < bufsize - 1024) while (nread < bufsize - 1024)
{ {
int this_read = emacs_read (fd[0], buf + nread, int this_read = emacs_read (fd[0], buf + nread,
bufsize - nread); bufsize - nread);
if (this_read < 0) if (this_read < 0)
goto give_up; goto give_up;
if (this_read == 0) if (this_read == 0)
{ {
process_coding.mode |= CODING_MODE_LAST_BLOCK; process_coding.mode |= CODING_MODE_LAST_BLOCK;
break; break;
} }
nread += this_read; nread += this_read;
total_read += this_read; total_read += this_read;
if (display_on_the_fly) if (display_on_the_fly)
break; break;
} }
/* Now NREAD is the total amount of data in the buffer. */ /* Now NREAD is the total amount of data in the buffer. */
immediate_quit = 0; immediate_quit = 0;
if (!NILP (buffer)) if (!NILP (buffer))
{ {
if (NILP (BVAR (current_buffer, enable_multibyte_characters)) if (NILP (BVAR (current_buffer, enable_multibyte_characters))
&& ! CODING_MAY_REQUIRE_DECODING (&process_coding)) && ! CODING_MAY_REQUIRE_DECODING (&process_coding))
insert_1_both (buf, nread, nread, 0, 1, 0); insert_1_both (buf, nread, nread, 0, 1, 0);
else else
{ /* We have to decode the input. */ { /* We have to decode the input. */
Lisp_Object curbuf; Lisp_Object curbuf;
int count1 = SPECPDL_INDEX (); int count1 = SPECPDL_INDEX ();
XSETBUFFER (curbuf, current_buffer); XSETBUFFER (curbuf, current_buffer);
/* We cannot allow after-change-functions be run /* We cannot allow after-change-functions be run
during decoding, because that might modify the during decoding, because that might modify the
buffer, while we rely on process_coding.produced to buffer, while we rely on process_coding.produced to
faithfully reflect inserted text until we faithfully reflect inserted text until we
TEMP_SET_PT_BOTH below. */ TEMP_SET_PT_BOTH below. */
specbind (Qinhibit_modification_hooks, Qt); specbind (Qinhibit_modification_hooks, Qt);
decode_coding_c_string (&process_coding, (unsigned char *) buf, decode_coding_c_string (&process_coding,
nread, curbuf); (unsigned char *) buf, nread, curbuf);
unbind_to (count1, Qnil); unbind_to (count1, Qnil);
if (display_on_the_fly if (display_on_the_fly
&& CODING_REQUIRE_DETECTION (&saved_coding) && CODING_REQUIRE_DETECTION (&saved_coding)
&& ! CODING_REQUIRE_DETECTION (&process_coding)) && ! CODING_REQUIRE_DETECTION (&process_coding))
{ {
/* We have detected some coding system. But, /* We have detected some coding system. But,
there's a possibility that the detection was there's a possibility that the detection was
done by insufficient data. So, we give up done by insufficient data. So, we give up
displaying on the fly. */ displaying on the fly. */
if (process_coding.produced > 0) if (process_coding.produced > 0)
del_range_2 (process_coding.dst_pos, del_range_2 (process_coding.dst_pos,
process_coding.dst_pos_byte, process_coding.dst_pos_byte,
process_coding.dst_pos process_coding.dst_pos
+ process_coding.produced_char, + process_coding.produced_char,
process_coding.dst_pos_byte process_coding.dst_pos_byte
+ process_coding.produced, 0); + process_coding.produced, 0);
display_on_the_fly = 0; display_on_the_fly = 0;
process_coding = saved_coding; process_coding = saved_coding;
carryover = nread; carryover = nread;
/* This is to make the above condition always /* This is to make the above condition always
fails in the future. */ fails in the future. */
saved_coding.common_flags saved_coding.common_flags
&= ~CODING_REQUIRE_DETECTION_MASK; &= ~CODING_REQUIRE_DETECTION_MASK;
continue; continue;
} }
TEMP_SET_PT_BOTH (PT + process_coding.produced_char, TEMP_SET_PT_BOTH (PT + process_coding.produced_char,
PT_BYTE + process_coding.produced); PT_BYTE + process_coding.produced);
carryover = process_coding.carryover_bytes; carryover = process_coding.carryover_bytes;
if (carryover > 0) if (carryover > 0)
memcpy (buf, process_coding.carryover, memcpy (buf, process_coding.carryover,
process_coding.carryover_bytes); process_coding.carryover_bytes);
} }
} }
if (process_coding.mode & CODING_MODE_LAST_BLOCK) if (process_coding.mode & CODING_MODE_LAST_BLOCK)
break; break;
/* Make the buffer bigger as we continue to read more data, /* Make the buffer bigger as we continue to read more data,
but not past CALLPROC_BUFFER_SIZE_MAX. */ but not past CALLPROC_BUFFER_SIZE_MAX. */
if (bufsize < CALLPROC_BUFFER_SIZE_MAX && total_read > 32 * bufsize) if (bufsize < CALLPROC_BUFFER_SIZE_MAX && total_read > 32 * bufsize)
if ((bufsize *= 2) > CALLPROC_BUFFER_SIZE_MAX) if ((bufsize *= 2) > CALLPROC_BUFFER_SIZE_MAX)
bufsize = CALLPROC_BUFFER_SIZE_MAX; bufsize = CALLPROC_BUFFER_SIZE_MAX;
if (display_p) if (display_p)
{ {
if (first) if (first)
prepare_menu_bars (); prepare_menu_bars ();
first = 0; first = 0;
redisplay_preserve_echo_area (1); redisplay_preserve_echo_area (1);
/* This variable might have been set to 0 for code /* This variable might have been set to 0 for code
detection. In that case, we set it back to 1 because detection. In that case, we set it back to 1 because
we should have already detected a coding system. */ we should have already detected a coding system. */
display_on_the_fly = 1; display_on_the_fly = 1;
} }
immediate_quit = 1; immediate_quit = 1;
QUIT; QUIT;
} }
give_up: ; give_up: ;
Vlast_coding_system_used = CODING_ID_NAME (process_coding.id); Vlast_coding_system_used = CODING_ID_NAME (process_coding.id);
/* If the caller required, let the buffer inherit the /* If the caller required, let the buffer inherit the
coding-system used to decode the process output. */ coding-system used to decode the process output. */
if (inherit_process_coding_system) if (inherit_process_coding_system)
call1 (intern ("after-insert-file-set-buffer-file-coding-system"), call1 (intern ("after-insert-file-set-buffer-file-coding-system"),
make_number (total_read)); make_number (total_read));
} }
#ifndef MSDOS #ifndef MSDOS
/* Wait for it to terminate, unless it already has. */ /* Wait for it to terminate, unless it already has. */
...@@ -875,7 +875,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) ...@@ -875,7 +875,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
signame = strsignal (synch_process_termsig); signame = strsignal (synch_process_termsig);
if (signame == 0) if (signame == 0)
signame = "unknown"; signame = "unknown";
synch_process_death = signame; synch_process_death = signame;
} }
...@@ -1058,18 +1058,18 @@ add_env (char **env, char **new_env, char *string) ...@@ -1058,18 +1058,18 @@ add_env (char **env, char **new_env, char *string)
{ {
char *p = *ep, *q = string; char *p = *ep, *q = string;
while (ok) while (ok)
{ {
if (*q != *p) if (*q != *p)
break; break;
if (*q == 0) if (*q == 0)
/* The string is a lone variable name; keep it for now, we /* The string is a lone variable name; keep it for now, we
will remove it later. It is a placeholder for a will remove it later. It is a placeholder for a
variable that is not to be included in the environment. */ variable that is not to be included in the environment. */
break; break;
if (*q == '=') if (*q == '=')
ok = 0; ok = 0;
p++, q++; p++, q++;
} }
} }
if (ok) if (ok)
*new_env++ = string; *new_env++ = string;
...@@ -1173,8 +1173,8 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L ...@@ -1173,8 +1173,8 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
new_length = 0; new_length = 0;
for (tem = Vprocess_environment; for (tem = Vprocess_environment;
CONSP (tem) && STRINGP (XCAR (tem)); CONSP (tem) && STRINGP (XCAR (tem));
tem = XCDR (tem)) tem = XCDR (tem))
{ {
if (strncmp (SSDATA (XCAR (tem)), "DISPLAY", 7) == 0 if (strncmp (SSDATA (XCAR (tem)), "DISPLAY", 7) == 0
&& (SDATA (XCAR (tem)) [7] == '\0' && (SDATA (XCAR (tem)) [7] == '\0'
...@@ -1227,11 +1227,11 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L ...@@ -1227,11 +1227,11 @@ child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, L
p = q = env; p = q = env;
while (*p != 0) while (*p != 0)
{ {
while (*q != 0 && strchr (*q, '=') == NULL) while (*q != 0 && strchr (*q, '=') == NULL)
q++; q++;
*p = *q++; *p = *q++;
if (*p != 0) if (*p != 0)
p++; p++;
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment