From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.6 required=5.0 tests=BAYES_05,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.3 4.3bsd-beta 6/6/85; site ucbvax.ARPA Path: utzoo!watmath!clyde!burl!ulysses!ucbvax!mit-multics.arpa!Bakin From: Bakin@MIT-MULTICS.ARPA ("David S. Bakin") Newsgroups: net.lang.ada Subject: Copying a file using text_io Message-ID: <850913235719.726375@MIT-MULTICS.ARPA> Date: Fri, 13-Sep-85 19:57:00 EDT Article-I.D.: MIT-MULT.850913235719.726375 Posted: Fri Sep 13 19:57:00 1985 Date-Received: Sat, 14-Sep-85 08:23:25 EDT Sender: daemon@ucbvax.ARPA Organization: The ARPA Internet List-Id: 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;