summaryrefslogtreecommitdiff
path: root/src/process.c
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2008-05-29 16:54:53 +0000
committerStefan Monnier <monnier@iro.umontreal.ca>2008-05-29 16:54:53 +0000
commit891bd142e24cc64eabde86d038c80dab66e37d36 (patch)
tree92a276922220a86fbb77de0949f9192782e6b3de /src/process.c
parentc2d0b538ee5f5ce37f27c0609e285eea581216af (diff)
downloademacs-891bd142e24cc64eabde86d038c80dab66e37d36.tar.gz
(Faccept_process_output): If `millisec' is non-nil, `seconds' default to 0.
(wait_reading_process_output): Also return non-nil if we read output from a non-running process.
Diffstat (limited to 'src/process.c')
-rw-r--r--src/process.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/src/process.c b/src/process.c
index e1735750806..413bd8522b3 100644
--- a/src/process.c
+++ b/src/process.c
@@ -3896,6 +3896,7 @@ Non-nil second arg SECONDS and third arg MILLISEC are number of
seconds and milliseconds to wait; return after that much time whether
or not there is input. If SECONDS is a floating point number,
it specifies a fractional number of seconds to wait.
+The MILLISEC argument is obsolete and should be avoided.
If optional fourth arg JUST-THIS-ONE is non-nil, only accept output
from PROCESS, suspending reading output from other processes.
@@ -3911,6 +3912,18 @@ Return non-nil if we received any output before the timeout expired. */)
else
just_this_one = Qnil;
+ if (!NILP (millisec))
+ { /* Obsolete calling convention using integers rather than floats. */
+ CHECK_NUMBER (millisec);
+ if (NILP (seconds))
+ seconds = make_float (XINT (millisec) / 1000.0);
+ else
+ {
+ CHECK_NUMBER (seconds);
+ seconds = make_float (XINT (millisec) / 1000.0 + XINT (seconds));
+ }
+ }
+
if (!NILP (seconds))
{
if (INTEGERP (seconds))
@@ -3924,19 +3937,6 @@ Return non-nil if we received any output before the timeout expired. */)
else
wrong_type_argument (Qnumberp, seconds);
- if (INTEGERP (millisec))
- {
- int carry;
- usecs += XINT (millisec) * 1000;
- carry = usecs / 1000000;
- secs += carry;
- if ((usecs -= carry * 1000000) < 0)
- {
- secs--;
- usecs += 1000000;
- }
- }
-
if (secs < 0 || (secs == 0 && usecs == 0))
secs = -1, usecs = 0;
}
@@ -4475,7 +4475,10 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
break;
if (0 < nread)
- total_nread += nread;
+ {
+ total_nread += nread;
+ got_some_input = 1;
+ }
#ifdef EIO
else if (nread == -1 && EIO == errno)
break;