#include <stdio.h>
#include <intuition/intuition.h>
#include <intuition/intuitionbase.h>

struct NewWindow newwin = {
	0, 0, 5, 5, 0, 1, IDCMP_INACTIVEWINDOW, WFLG_ACTIVATE, NULL, NULL,
	NULL, NULL, NULL, 0, 0, 0, 0, WBENCHSCREEN
};
struct IntuitionBase *IntuitionBase;
struct Library *OpenLibrary();
struct Window *OpenWindow(), *win=0, *destwin;
UWORD data[] = {
	0x0, 0x0,
	0, 0,
	0x0, 0x0
};

void bye();

main(int ac, char **av)
{
	if (!strcmp(av[1], "foo")) bye();
	if (!(IntuitionBase = (struct IntuitionBase *)
	  OpenLibrary("intuition.library", 37L)))	{
		fprintf(stderr, "can't open i.l\n");
		bye();
	}
	if (!(win = OpenWindow(&newwin)))	{
		fprintf(stderr, "!win\n");
		bye();
	}
	WaitPort(win->UserPort);  /* no need for GetMsg(), only one IDCMP */
	destwin = IntuitionBase->ActiveWindow;
	CloseWindow(win);
	SetPointer(destwin, &data, 0, 0, 0, 0);
	bye();
}
void bye()
{
	if (IntuitionBase)
		CloseLibrary(IntuitionBase);
	exit(0);
}
