Figure 36.
Improved version of Show.
--------------------------------------------------------
-- SHOW.ada
-- 9 June 1987
-- Do-While Jones
with Get_Command_Line;
with TEXT_IO; use TEXT_IO;
procedure Show is
TEXT : string(1..200);
LENGTH : natural;
FILE : File_type;
begin
Get_Command_Line(TEXT,LENGTH);
if LENGTH = 0 then
put("What file? ");
get_line(TEXT,LENGTH);
end if;
Open(FILE, IN_FILE, TEXT(1..LENGTH));
MAIN:
loop
for i in 1..22 loop
exit MAIN when End_Of_File(FILE);
get_line(FILE, TEXT, LENGTH);
put_line(TEXT(1..LENGTH));
end loop;
put_line("Press RETURN for the next screen");
get_line(TEXT,LENGTH);
end loop MAIN;
exception
when NAME_ERROR =>
put("File """);put(TEXT(1..LENGTH));
put_line(""" could not be found.");
end Show;