home *** CD-ROM | disk | FTP | other *** search
-
- {********** terminal.inc **********}
- { terminal mode }
-
- procedure terminal_mode;
- var
- local, local1, local2: char;
- temp,command,printer: boolean;
- const
- func : data = 'Phillip;Hansford';
-
- procedure do_filter(var ch: char);
- {Convert cntl code to null --
- all control codes except Bell, Line Feed,
- and Carriage Return are converted to null}
- begin
- if ch in [^A..^_, chr($7F)] then
- if ch in [chr($07)..LF, CR] then else
- ch:= ^@;
- end; {do_filter}
-
- procedure logon;
- label unclog;
- var
- local,local1: char;
- temp: dataa;
- log: array[1..20] of string[40];
- J,numbr,segment: integer;
- toot: boolean;
- begin
- if autolog and log_on then begin
- writeln('++ auto logon ++');
- writeln('====================');
- writeln('-->^X to quit');
- segment:= 1;
- numbr:= extractCount(logline);
- for J:= 1 to numbr do log[J]:= extract(logline,J);
- modem_out_line('');
-
- repeat
- sinp(local); if local = ^X then goto unclog;
- local1:= modem_in;
-
- sinp(local); if local = ^X then goto unclog;
- if filter then do_filter(local1);
- write(local1);
- if printer then write(Lst,local1);
-
- sinp(local); if local = ^X then goto unclog;
- temp:= log[segment];
- if temp= '$' then temp:= ^G;
- if temp= '^' then begin
- delay(500);
- modem_out(^C);
- end;
- if temp= '#' then begin
- delay(4000);
- modem_out(CR);
- sinp(local); if local = ^X then goto unclog;
- delay(500);
- sinp(local); if local = ^X then goto unclog;
- modem_out(CR);
- sinp(local); if local = ^X then goto unclog;
- delay(500);
- modem_out(CR);
- sinp(local); if local = ^X then goto unclog;
- delay(500);
- modem_out(CR);
- sinp(local); if local = ^X then goto unclog;
- delay(500);
- temp:= '';
- end;
- sinp(local); if local = ^X then goto unclog;
- if (local1 = temp) or (temp = '')
- then begin
- sinp(local); if local = ^X then goto unclog;
- segment:= segment+ 1;
- temp:= log[segment];
- if temp = ',' then begin
- delay(2000);
- modem_out_line('');
- sinp(local); if local = ^X then goto unclog;
- end
- else
- delay(100);
- if (not hiBaud) or slowbaud then delay(400);
- modem_out_line(temp);
- sinp(local); if local = ^X then goto unclog;
- segment:= segment+ 1;
- end;
-
- sinp(local); if local = ^X then goto unclog;
- until segment >= numbr;
- unclog:
- writeln;
- writeln('=(',segment,')================');
- autolog:= false;
- end;
- end; {logon}
-
- begin {terminal_mode}
- printer:= false;
- if not host_mode then begin
- write('TERMINAL MODE (');
- if carrier then writeln('carrier)') else writeln('no carrier)');
- writeln('(^P - printer, ^E - menu)');
- end;
- writeln;
- if carrier and not host_mode then logon;
- if (not carrier) and duplex then command:= true
- else command:= false;
- line:= '';
- repeat
- sinp(local);
- if local <> ^@ then begin {^@ is 0 = no char}
- if local in [^E, ^P, ESC] then else begin;
- if command then local:= upCase(local);
- modem_out(local);
- if not duplex then write(local); {half-duplex}
- if command then begin
- line:= line + local;
- write(local);
- end;
- end;
- case local of
- ^M: begin {ie. CR}
- {modem_out(LF);}
- if not duplex then begin
- modem_out(LF);
- write(LF);
- end;
- if command then write(LF);
- end;
- ^P: printer:= not printer;
- ^@: begin
- writeln('Break noted');
- delay(100);
- end;
- ^[: begin
- delay(10); {check for function key}
- sinp(local2);
- if local2 = 'S' then begin {function 1 key}
- modem_out_line(func);
- if not duplex then writeln(log_on);
- end
- else if local2 = ^@ then begin {not function key}
- modem_out(local);
- if not duplex then write(local);
- end;
- end;
- end;
- end;
- if Modem_In_Ready then begin
- local1:= getMod;
- if filter then do_filter(local1);
- write(local1);
- if not duplex then modem_out(local1);
- if printer then write(Lst,local1);
- end;
- until local= ^E;
- modem_out(^@); {any chr to hang up if dialing}
- end; {terminal_mode}
-