diff options
Diffstat (limited to 'ipl/progs/iheader.icn')
-rw-r--r-- | ipl/progs/iheader.icn | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/ipl/progs/iheader.icn b/ipl/progs/iheader.icn new file mode 100644 index 0000000..2bc3fb8 --- /dev/null +++ b/ipl/progs/iheader.icn @@ -0,0 +1,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 |