home *** CD-ROM | disk | FTP | other *** search
/ The CDPD Public Domain Collection for CDTV 4 / CDPD_IV.bin / networking / dnet / dnet2.3.2 / amiga / lib / dquit.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-29  |  860 b   |  52 lines

  1.  
  2. /*
  3.  *  DQuit.C
  4.  */
  5.  
  6. #include "lib.h"
  7.  
  8. int
  9. DBreak(host)
  10. char *host;
  11. {
  12.     char buf[sizeof(DNETPORTNAME)+32];
  13.     PORT *dnetport;
  14.  
  15.     if (!host)
  16.     host = "0";
  17.     sprintf(buf, "%s%s", DNETPORTNAME, host);
  18.     Forbid();
  19.     if (dnetport = FindPort(buf))
  20.     Signal(dnetport->mp_SigTask, SIGBREAKF_CTRL_C);
  21.     Permit();
  22. }
  23.  
  24. int
  25. DQuit(host)
  26. char *host;
  27. {
  28.     IOSTD ior;
  29.     char buf[sizeof(DNETPORTNAME)+32];
  30.     PORT *replyport = CreatePort(NULL, 0);
  31.     PORT *dnetport;
  32.  
  33.     if (!host)
  34.     host = "0";
  35.     sprintf(buf, "%s%s", DNETPORTNAME, host);
  36.     Forbid();
  37.     if (dnetport = FindPort(buf)) {
  38.         Permit();
  39.     ior.io_Command = DNCMD_QUIT;
  40.     ior.io_Unit = 0;
  41.     ior.io_Offset = (ulong)0;
  42.     ior.io_Message.mn_ReplyPort = replyport;
  43.     PutMsg(dnetport, (MSG *)&ior);
  44.     WaitMsg(&ior);
  45.     DeletePort(replyport);
  46.     } else {
  47.     Permit();
  48.     }
  49.     return(dnetport != NULL);
  50. }
  51.  
  52.