program LISTPACK ( input, tty );
 
(* This program examines a file of concatenated sources.
   A list of module namesis produced. Each module
   must start with one line giving the file name and
   end with one line containing '****'.
   Such packing is performed by the program PACK.   *)
 
var   FILNAM: array (.0..20.) of char;
      I,J,NSTAR: integer;
      C: CHAR;
      EOM: boolean;
 
begin   write( tty, 'Name of packed file: ');   break;
 readln(tty);   J:=0;   FILNAM:='                     ';
 while not eoln(ttyin) do
   begin   read(tty,FILNAM(.J.));  J := J+1   end;
 reset( input, FILNAM );
 if eof(input) then writeln( tty, FILNAM, 'not found')
 else   while not eof(input) do
  begin     FILNAM :='                     ';   I := 0;
   while not eoln(input) and ( I<20 ) do
    begin   read( FILNAM(.I.) );   I := I+1   end;
   readln;     EOM := false;
   writeln( tty, FILNAM );
   while not EOM do
    begin        NSTAR := 0;
     for I:=1 to 4 do
      if input^ = '*' then
       begin   NSTAR := NSTAR+1;   get(input)   end;
     EOM := NSTAR = 4;
     readln;
    end;
  end
end.
