File: wc.tcl

package info (click to toggle)
nvi 1.79-20
  • links: PTS
  • area: main
  • in suites: woody
  • size: 5,384 kB
  • ctags: 3,767
  • sloc: ansic: 42,491; sh: 1,534; tcl: 1,124; makefile: 784; perl: 240; awk: 24; csh: 13
file content (16 lines) | stat: -rw-r--r-- 381 bytes parent folder | download | duplicates (19)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#	@(#)wc.tcl	8.2 (Berkeley) 11/18/95
#
proc wc {} {
	global viScreenId
	global viStartLine
	global viStopLine

	set lines [viLastLine $viScreenId]
	set output ""
	set words 0
	for {set i $viStartLine} {$i <= $viStopLine} {incr i} {
		set outLine [split [string trim [viGetLine $viScreenId $i]]]
		set words [expr $words + [llength $outLine]]
	}
	viMsg $viScreenId "$words words"
}