
/*
 *  DStat.C
 */

#include "lib.h"

int
DStat(host, buffer, max)
char *host;
APTR buffer;
long max;
{
    IOSTD ior;
    char buf[sizeof(DNETPORTNAME)+32];
    PORT *replyport = CreatePort(NULL, 0);
    PORT *dnetport;

    if (!host)
	host = "0";
    sprintf(buf, "%s%s", DNETPORTNAME, host);
    Forbid();
    if (dnetport = FindPort(buf)) {
	Permit();
	ior.io_Command = DNCMD_INFO;
	ior.io_Unit = 0;
	ior.io_Offset = (ulong)0;
	ior.io_Data = buffer;
	ior.io_Message.mn_ReplyPort = replyport;
	PutMsg(dnetport, (MSG *)&ior);
	WaitMsg(&ior);
	DeletePort(replyport);
    } else
    	Permit();

    return(dnetport != NULL);
}

