summaryrefslogtreecommitdiff
path: root/ipl/progs/lc.icn
blob: 937425df5e10a30ff20d61948ddc7068e6fcc68d (plain)
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
36
37
38
39
############################################################################
#
#	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