1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00
freebsd/contrib/nvi/tcl_scripts/wc.tcl
Peter Wemm b8ba871bd9 Import of nvi-1.79, minus a few bits that we dont need (eg: postscript
files, curses, db, regex etc that we already have).  The other glue will
follow shortly.

Obtained from: Keith Bostic <bostic@bostic.com>
1996-11-01 06:45:43 +00:00

17 lines
381 B
Tcl

# @(#)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"
}