PROGRAM copyf (input,output); (* Reorder overprinted lines to place the first last. *) (* This makes the output legible on CRTs. An overprinted *) (* line ends in rather than . PascalP *) (* text input totally ignores all chars. *) (* PARM = 2 marks output in same manner *) (* = 4 marks with in place of *) (* = 8 marks overprinted lines with initial ^A <01h> *) (* = 0 (default) converts into multiple lines *) TYPE string = PACKED ARRAY[1..100] OF char; VAR markem, doublcr, multiline : boolean; ln, lnhold : string; (* 1---------------1 *) PROCEDURE checkhelp; VAR fn : ARRAY[1..28] OF char; BEGIN filename(input, fn); (*$s-*) IF fn[1 FOR 4] = 'CON:' THEN BEGIN (* no input redirection *) (*$s+*) writeln('COPYF outfile [parm]'); writeln; writeln('all arguments optional. No "'); writeln(' rather than the original mark of '); writeln(' 8 suppresses the in an overprint mark'); writeln('Precedence of commands is 2, then 4, then 8'); writeln; writeln('Further input from console (1 line out delay) until'); writeln('^Z EOF mark UNLESS an initial $ specifies a new input'); writeln('file, i.e.'); writeln; writeln('$yourfile.ext switches input to yourfile'); writeln; IF input^ = '$' THEN BEGIN get(input); readln(fn); reset(input, fn); END; (* causes compile warning *) END; END; (* 1---------------1 *) BEGIN multiline := mask(getparm, 2) <> 0; doublcr := mask(getparm, 4) <> 0; markem := mask(getparm, 8) = 0; checkhelp; WHILE NOT eof DO BEGIN readln(ln); WHILE input^ = chr(0) DO BEGIN get(input); readln(lnhold); (* preserve the overprint mark *) write(lnhold : length(lnhold)); IF multiline THEN writeln ELSE BEGIN overprint; IF doublcr THEN overprint ELSE IF markem THEN write(chr(0)); END END; writeln(ln : length(ln)); END; END.