home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 200-299 / ff294.lzh / DNet / amiga / lib / dopen.c < prev    next >
C/C++ Source or Header  |  1989-12-11  |  850b  |  48 lines

  1.  
  2. /*
  3.  *  DOpen.C
  4.  */
  5.  
  6. #include "lib.h"
  7.  
  8. PORT *
  9. DOpen(host, portnum, txpri, rxpri)
  10. char *host;
  11. int txpri, rxpri;
  12. uword portnum;
  13. {
  14.     IOSTD ior;
  15.     CHANN *chan;
  16.  
  17.     if (!host)
  18.     host = "0";
  19.     chan = (CHANN *)MakeChannel(&ior, host);
  20.     if (rxpri > 126)
  21.     rxpri = 126;
  22.     if (rxpri < -127)
  23.     rxpri = -127;
  24.     if (txpri > 126)
  25.     txpri = 126;
  26.     if (txpri < -127)
  27.     txpri = -127;
  28.     if (chan->dnetport) {
  29.     ior.io_Command = DNCMD_OPEN;
  30.     ior.io_Unit = (void *)portnum;
  31.     ior.io_Offset = (long)chan;
  32.     ior.io_Message.mn_ReplyPort = (PORT *)chan;
  33.     ior.io_Message.mn_Node.ln_Pri = txpri;
  34.     ior.io_Message.mn_Node.ln_Name= (char *)rxpri;
  35.  
  36.     PutMsg(chan->dnetport, (MSG *)&ior);
  37.     WaitMsg(&ior);
  38.     if (ior.io_Error == 0) {
  39.         chan->chan = (long)ior.io_Unit;
  40.         FixSignal(chan);
  41.         return((PORT *)chan);
  42.     }
  43.     }
  44.     DeleteChannel(chan);
  45.     return(NULL);
  46. }
  47.  
  48.