blob: 2bc3fb856391921d26b678b90386a5116e137c27 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
############################################################################
#
# File: iheader.icn
#
# Subject: Program to list Icon program library headers
#
# Author: Ralph E. Griswold
#
# Date: June 14, 1994
#
############################################################################
#
# This file is in the public domain.
#
############################################################################
#
# This program lists the headers of Icon programs whose file names are
# given on the command line. It complains if the header does not start
# correctly but otherwise does not check the syntax of what follows.
#
############################################################################
global input
procedure main(args)
local file, line, bar
bar := repl("#", 76)
every file := !args do {
write(file, ":")
input := open(file) | {
write("*** cannot open file")
close(\input)
next
}
line := read(input) | {
write("*** empty file")
close(\input)
next
}
if line ~== bar then {
write("*** invalid first line")
close(\input)
next
}
while line := read(input) do {
if line == bar then {
close(input)
break
}
else write(line)
}
}
end
|