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 / dstat.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-29  |  630 b   |  39 lines

  1.  
  2. /*
  3.  *  DStat.C
  4.  */
  5.  
  6. #include "lib.h"
  7.  
  8. int
  9. DStat(host, buffer, max)
  10. char *host;
  11. APTR buffer;
  12. long max;
  13. {
  14.     IOSTD ior;
  15.     char buf[sizeof(DNETPORTNAME)+32];
  16.     PORT *replyport = CreatePort(NULL, 0);
  17.     PORT *dnetport;
  18.  
  19.     if (!host)
  20.     host = "0";
  21.     sprintf(buf, "%s%s", DNETPORTNAME, host);
  22.     Forbid();
  23.     if (dnetport = FindPort(buf)) {
  24.     Permit();
  25.     ior.io_Command = DNCMD_INFO;
  26.     ior.io_Unit = 0;
  27.     ior.io_Offset = (ulong)0;
  28.     ior.io_Data = buffer;
  29.     ior.io_Message.mn_ReplyPort = replyport;
  30.     PutMsg(dnetport, (MSG *)&ior);
  31.     WaitMsg(&ior);
  32.     DeletePort(replyport);
  33.     } else
  34.         Permit();
  35.  
  36.     return(dnetport != NULL);
  37. }
  38.  
  39.