program PACK ( input, output, tty ); (* This program compresses arbitrary source files to one file with unpacking information in it. The names of the source files are given from the terminal. The resulting file contains for each file: - one line with the file name - the source module lines - one line containing '****' Unpacking can be performed by the program UNPACK. *) var I,J,K: integer; C: char; FILNAM: array (.0..20.) of char; begin write( tty, 'Output file name: '); break; readln(tty); FILNAM := ' '; J := 0; while not eoln(ttyin) do begin read(tty, FILNAM(.J.) ); J := J+1 end; rewrite( output, FILNAM ); loop write( tty, 'Source file: '); break; readln(tty); exit if eoln(ttyin); FILNAM := ' '; J:=0; 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 begin writeln( FILNAM ); while not eof(input) do begin (* copy a line *) while not eoln(input) do begin read(c); write(c) end; readln; writeln; end; writeln('****'); end; end; writeln(tty,'ready') end.