[comp.protocols.appletalk] NCSA Telnet 2.3.x

sw@network-analysis-ltd.co.uk (Sak Wathanasin) (08/14/90)

Has anyone been able to rebuild Telnet from the srcs at the NCSA
FTP site? I've been trying to convert them to MPW 3.1, and I believe
I have sorted out all the problems with C/Pascal strings, the different
toolbox calls etc, and have now hit a problem with the ioCompletion routines.

The MacTCP header files declare the TCP ioCompletion routines as

  typedef void (*TCPIOCompletionProc) (struct TCPiopb *iopb);

and that is how they are declared in the Telnet srcs; for example:

  long openComplete( pbp)
  TCPiopb *pbp;
  {
   StreamRPtr p;
   int pnum;
   
   myWorld();
   
   ...etc...
   
   theirWorld();
   return(0);
   
  }

However, Inside Mac says that IO completion routines are called with
a ptr to the param block in register A0, and the ioResult in register
D0, and Macsbug confirms that this is indeed the case. 

So how does NCSA Telnet work (as it evidently does) when it expects
to find its parameter on the stack? myWorld(), incidentally, is an
assembler proc which smashes A0 in the first instruction (!): 

  myWorld
    LEA  A5save,A0  ; Prepare to save current A5
    MOVE.L A5,D0   ; Move to valid spot
    MOVE.L D0,(a0)   ; store it 
  
    LEA  A5ptr,A0  ; Ready to get ours?
    MOVEA.L (a0),A5   ; Load 'er up!
  
    RTS

Can someone enlighten me? Many thanks in advance.

Yours puzzled,


--
Sak Wathanasin
Network Analysis Limited

uucp:	...!ukc!nan!sw
other:	sw@network-analysis-ltd.co.uk
phone:  (+44) 203 419996
telex:  9312130355 (SW G)
snail:  178 Wainbody Ave South, Coventry CV3 6BX, UK