19-Aug-87 06:14:14-EDT,5994;000000000001
Return-Path: <SYSKERMIT%vax1.central.lancaster.ac.uk@Cs.Ucl.AC.UK>
Received: from Cs.Ucl.AC.UK (TUNNEL.CS.UCL.AC.UK) by CU20B.COLUMBIA.EDU with TCP; Wed 19 Aug 87 06:13:18-EDT
Received: from vax1.central.lancaster.ac.uk by nss.Cs.Ucl.AC.UK 
           via Janet with NIFTP  id aa04934; 19 Aug 87 11:11 BST
Date:		19-AUG-1987 11:11:20
From:		SYSKERMIT%vax1.central.lancaster.ac.uk@Cs.Ucl.AC.UK
To:		INFO-KERMIT <@nss.cs.ucl.ac.uk:INFO-KERMIT@cu20b.columbia.edu>
Subject:	Update to KERMIT for UCSD(UCT)



   In the following you will find two of the pieces of UCSD pSystem Kermit
which I've altered to handle text files properly - binary file transfer is
right out because, apart from anything else, the pSystem II.0 BIOS can't
read/write binary files byte by byte correctly, so that's a non-starter. 

   I originally fixed the bug that the receive routines expected the sequence
'#M#J' to occur together, so a '#M' at the end of a message followed by '#J' at
the start of the next got things confused. The final fix is to totally ignore
all '#'-codes except the sequence '#M#J' (whether adjacent or not), so as to
ensure reliable text file transfer *without* confusing the filing system with
unexpected control characters. 

   The changes are to RECSW.TEXT and KERMIT.TEXT which are part of the
concatenated source [.UCT]UCTERAK.PAS. Diff listings for these two files are
below. 

Nick Rothwell,   Laboratory for Foundations of Computer Science,
                 University of Edinburgh.
                 ARPA:    nick%{cstvax,itspna}.ed.ac.uk@cs.ucl.ac.uk
                 JANET:   nick@uk.ac.ed.{cstvax,itspna}
                 UUCP:    <Atlantic Ocean>!mcvax!ukc!{cstvax,itspna}!nick


************
File KERMIT.OLD;1
    1   >>>>> KERMIT.TEXT
    2   program kermit;
    3   
    4   (* $R-*) (* turn range checking off *)
******
File KERMIT.NEW;3
    1   >>>> KERMIT.TEXT
    2   program kermit;
    3   
    4   {Fixed by NICK: the receive routines ('bufemp') assumed that #M and #J
    5    always occurred together, so an isolated #J would write a spurious linefeed.
    6    This is fixed. We also ignore any '#' codes except the sequence #M#J.
    7   
    8   }
    9    
   10   (* $R-*) (* turn range checking off *)
************
************
File KERMIT.OLD;1
    7   (*$U PARSELIB.CODE*)
    8   USES PARSER;
    9   
******
File KERMIT.NEW;3
   13   USES {$U PARSELIB.CODE} PARSER;
   14   
************
************
File KERMIT.OLD;1
   94   
******
File KERMIT.NEW;3
   99       HaveHashM: Boolean;   {NICK}
  100   
************
************
File KERMIT.OLD;1
  429   
  430   (* empties a packet into a file *)
******
File KERMIT.NEW;3
  435     {NICK: This procedure heavily modified}
  436   (* empties a packet into a file *)
************
************
File KERMIT.OLD;1
  450           if (r.i = cr) then          (* else if a carriage return then *)
  451             begin
  452               i := i + 3;               (* skip over that and line feed *)
  453               (*$I-*)                   (* turn i/o checking off *)
  454               writeln(f,s);             (* and write out line to file *)
  455               s := copy('',0,0);        (* empty the string var *)
  456               ls := 0;
  457               if (io_result <> 0) then  (* if io_error *)
  458                 begin
  459                   io_error(ioresult);     (* tell them and *)
  460                   state := 'a';           (* abort *)
  461                 end (* if *)
  462             end
  463         (*$I+*)                      (* turn i/o checking back on *)
******
File KERMIT.NEW;3
  456           if (r.i = cr) then begin
  457             i := i + 1;
  458             HaveHashM := True;   {NICK}
  459           end else if (r.i = lf) then
  460             begin
  461              {NICK:}
  462               i := i + 1;               (* skip over that ... *)
  463               IF HaveHashM then begin   {NICK: write line ONLY if #M#J}
  464                 (*$I-*)                   (* turn i/o checking off *)
  465                 writeln(f,s);             (* and write out line to file *)
  466                 s := copy('',0,0);        (* empty the string var *)
  467                 ls := 0;
  468                 if (io_result <> 0) then  (* if io_error *)
  469                   begin
  470                     io_error(ioresult);     (* tell them and *)
  471                     state := 'a';           (* abort *)
  472                   end (* if *)
  473               end;
  474               HaveHashM := False
  475             end
  476           else if (r.ch < ' ') then begin
  477             i := i + 1;   {NICK: ignore any other control}
  478             HaveHashM := false
  479           end
  480         (*$I+*)                      (* turn i/o checking back on *)
************
************
File KERMIT.OLD;1
  466               r.i := aand(r.i,127);     (* mask off parity bit *)
******
File KERMIT.NEW;3
  483                HaveHashM := false;
  484               r.i := aand(r.i,127);     (* mask off parity bit *)
************
************
File KERMIT.OLD;1
  483   function bufill(*var buffer: packettype): integer*);
******
File KERMIT.NEW;3
  501   
  502   function bufill(*var buffer: packettype): integer*);
************
************
File KERMIT.OLD;1
 1142   
******
File KERMIT.NEW;3
************

----------------------------------------------------------------
************
File RECSW.OLD;2
    3   
    4   (* RECEIVE SECTION *)
******
File RECSW.NEW;2
    3   (* RECEIVE SECTION *)
************
************
File RECSW.OLD;2
  315   
******
File RECSW.NEW;2
  314       HaveHashM := False;      {NICK: clear the #M#J state flag}
  315   
************
************
File RECSW.OLD;2
******
File RECSW.NEW;2
  337   
************


-------
