
/*
 *  DQuit.C
 */

#include "lib.h"

int
DBreak(host)
char *host;
{
    char buf[sizeof(DNETPORTNAME)+32];
    PORT *dnetport;

    if (!host)
	host = "0";
    sprintf(buf, "%s%s", DNETPORTNAME, host);
    if (dnetport = FindPort(buf))
	Signal(dnetport->mp_SigTask, SIGBREAKF_CTRL_C);
}

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

    if (!host)
	host = "0";
    sprintf(buf, "%s%s", DNETPORTNAME, host);
    if (dnetport = FindPort(buf)) {
	ior.io_Command = DNCMD_QUIT;
	ior.io_Unit = 0;
	ior.io_Offset = 0;
	ior.io_Message.mn_ReplyPort = replyport;
	PutMsg(dnetport, (MSG *)&ior);
	WaitMsg(&ior);
	DeletePort(replyport);
    }
    return(dnetport != NULL);
}

