home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-05-09 | 721 b | 30 lines | [TEXT/PICN] |
- ############################################################################
- #
- # head.icn
- #
- # This program prints the first lines of a file. The user
- # is prompted with a Get File dialog and the program continues to
- # process files until the user selects Cancel in a Get File dialog.
- #
- # Option:
- #
- # n Number of lines to print. The default is 10.
- #
- #############################################################################
-
- procedure main(args)
- local i, name, infile
-
- i := integer(args[1]) | 10
-
- while name := getfile("File?") do {
- close(\infile)
- infile := open(name) | {
- write(&errout,"*** cannot open ",name)
- next
- }
- every 1 to i do
- write(read(infile)) | break
- }
- end
-