/*
 *	End.c - Copyright © 1990 by Devil's child.
 *
 *	Created:	08 Oct 1990  20:51:16
 *	Modified:	09 Nov 1990  17:36:30
 *
 *	Make>> cc -qf -ps -m0b -wp -wd -wu -so -hi ram:ParM.syms <file>.c
 *	Make>> ln <file>.o
 *	Make>> Protect <file> +p
 */


void main(void)
{
	struct ExecBase *SysBase = *((struct ExecBase **)4L);
	struct ArpBase *ArpBase;
	struct Process *MyProcess;
	struct InfoData *infodata;
	long args[8];
	struct Window *W;
	struct MsgPort *ReplyPort;
	struct IntuiMessage Msg;

	if (!(ArpBase = (struct ArpBase *)OpenLibrary("arp.library", 39L))) return;

	MyProcess = (struct Process *)SysBase->ThisTask;
	infodata = ArpAlloc(sizeof(struct InfoData));
	args[0] = (long)infodata >> 2;
	SendPacket(ACTION_DISK_INFO, args, (struct MsgPort *)MyProcess->pr_ConsoleTask);
	W = (struct Window *)infodata->id_VolumeNode;
	if ( (W->IDCMPFlags & MENUPICK) && (ReplyPort = CreatePort(NULL, NULL)) ) {
		Msg.Class = CLOSEWINDOW;
		Msg.ExecMessage.mn_Node.ln_Type = NT_MESSAGE;
		Msg.ExecMessage.mn_Length = sizeof( struct IntuiMessage );
		Msg.ExecMessage.mn_ReplyPort = ReplyPort;      
		PutMsg(W->UserPort, (struct Message *)&Msg);
		WaitPort(ReplyPort);
		GetMsg(ReplyPort);
		DeletePort(ReplyPort);
	}
	SyncRun("EndCLI", NULL, NULL, NULL);
	CloseLibrary(ArpBase);
}

