home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
historic
/
v941.tgz
/
icon.v941src.tar
/
icon.v941src
/
ipl
/
progs
/
lc.icn
< prev
next >
Wrap
Text File
|
2000-07-29
|
872b
|
40 lines
############################################################################
#
# File: lc.icn
#
# Subject: Program to count lines in file
#
# Author: Ralph E. Griswold
#
# Date: July 19, 1994
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# This program simply counts the number of lines in standard input
# and writes the result to standard output.
#
# Assumes UNIX-style line terminators.
#
# Requires lots of memory as written.
#
############################################################################
procedure main()
local count, line
count := 0
while line := reads(, 1000000) do
line ? {
every upto('\n') do
count +:= 1
}
write(count)
end