File: tcp_wait

package info (click to toggle)
zsh-beta 4.3.17-dev-0%2B20120621-1
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 19,804 kB
  • sloc: ansic: 95,966; sh: 5,899; makefile: 845; perl: 745; awk: 383; sed: 16
file content (18 lines) | stat: -rw-r--r-- 459 bytes parent folder | download | duplicates (16)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Wait for given number of seconds, reading any data from
# all TCP connections while doing so.

if [[ ${(t)SECONDS} != float* ]]; then
    # If called from tcp_expect, don't override
    typeset -F TCP_SECONDS_START=$SECONDS
    # Get extra accuracy by making SECONDS floating point locally
    typeset -F SECONDS
fi

typeset to end

(( to = $1, end = SECONDS + to ))
while (( SECONDS < end )); do
  tcp_read -a -T $to
  (( to = end - SECONDS ))
done
return