File: bgtest.tcl

package info (click to toggle)
blt 2.5.3%2Bdfsg-4
  • links: PTS
  • area: main
  • in suites: buster
  • size: 24,864 kB
  • sloc: ansic: 133,724; tcl: 17,680; sh: 2,722; makefile: 799; cpp: 370
file content (35 lines) | stat: -rw-r--r-- 547 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35

set fid [open "../README" "r"]
set data [read $fid]
close $fid

regsub -all "\r|\n|\t" $data " " data 
set data [split $data " "]

set count 0
set maxWords 500
foreach word $data {
    if { $word == "" }  {
	continue
    }
    if { $count & 0x1 } {
	puts -nonewline stderr "($word)"
	flush stderr
    } else {
	puts -nonewline stdout "($word)"
	flush stdout
    }
    incr count
    if { ($count % 10) == 0 } {
	puts stdout ""
	puts stderr ""
	flush stdout
	flush stderr
    }
    if { $count > $maxWords } {
	break
    }
    after 500
}
exit 0