{************************************************************** Show file with controls Types the givien file, and expands the control characters out into our \ctl format (\cr and \lf are excepted). **************************************************************} program ShowControls(source, { file to show } output); { prints to } var c : char; { buffer } source: text; procedure expand(c : char); { expand and print control sequence } begin if ord(c) > 127 then c := chr(ord(c) - 128); { strip any high bit } if (ord(c) >= ord(' ')) and (c <> '\del') then write(c) { write printable character } else case c of { write control character } '\nul': write('\\nul'); '\soh': write('\\soh'); '\stx': write('\\stx'); '\etx': write('\\etx'); '\eot': write('\\eot'); '\enq': write('\\enq'); '\ack': write('\\ack'); '\bel': write('\\bel'); '\bs': write('\\bs'); '\ht': write('\\ht'); '\lf': write('\\lf'); '\vt': write('\\vt'); '\ff': write('\\ff'); '\cr': write('\\cr'); '\so': write('\\so'); '\si': write('\\si'); '\dle': write('\\dle'); '\dc1': write('\\dc1'); '\dc2': write('\\dc2'); '\dc3': write('\\dc3'); '\dc4': write('\\dc4'); '\nak': write('\\nak'); '\syn': write('\\syn'); '\etb': write('\\etb'); '\can': write('\\can'); '\em': write('\\em'); '\sub': write('\\sub'); '\esc': write('\\esc'); '\fs': write('\\fs'); '\gs': write('\\gs'); '\rs': write('\\rs'); '\us': write('\\us'); '\del': write('\\del') end end; begin { ShowControls } reset(source); { open source file } while not eof(source) do begin while not eoln(source) do begin read(source, c); { read character } expand(c) { print } end; readln(source); { next line } writeln end end.