home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Spezial / SPEZIAL2_97.zip / SPEZIAL2_97.iso / ANWEND / EDITOR / NVI179B / NVI179B.ZIP / tcl_scripts / wc.tcl < prev   
Text File  |  1995-11-18  |  381b  |  17 lines

  1. #    @(#)wc.tcl    8.2 (Berkeley) 11/18/95
  2. #
  3. proc wc {} {
  4.     global viScreenId
  5.     global viStartLine
  6.     global viStopLine
  7.  
  8.     set lines [viLastLine $viScreenId]
  9.     set output ""
  10.     set words 0
  11.     for {set i $viStartLine} {$i <= $viStopLine} {incr i} {
  12.         set outLine [split [string trim [viGetLine $viScreenId $i]]]
  13.         set words [expr $words + [llength $outLine]]
  14.     }
  15.     viMsg $viScreenId "$words words"
  16. }
  17.