Bakin@MIT-MULTICS.ARPA ("David S. Bakin") (09/14/85)
By the way, here is the best way I've found to copy a file using text_io (it copies standard-input to standard-output). This program has already been used as a quick basis for 3 useful filters. Just plug into procedure 'process_a_line' something that does what you want to do. -- Dave (Bakin -at mit-multics.arpa) -------------------------- cut here -------------------------------------- with text_io; procedure file_copy is -- If a file ends in a blank line, won't copy it. -- If a file ends in a line which only has a form feed, won't copy it. -- If a file ends in a blank line, followed by a line which only has -- a form feed, won't copy either of those two lines! use text_io; a_line: string (1 .. 1024); a_len: natural; page_skipped: boolean := false; procedure read_a_line is prev_page: positive_count := page(standard_input); begin get_line (a_line, a_len); if page(standard_input) /= prev_page and not end_of_file then page_skipped := true; end if; end; procedure process_a_line is begin null; end; procedure write_a_line is begin put_line (a_line (1 .. a_len)); if page_skipped then new_page; page_skipped := false; end if; end; begin while not end_of_file loop read_a_line; process_a_line; write_a_line; end loop; end file_copy;