/* put up a simple requester */

#include	<exec/types.h>
#include	<intuition/intuitionbase.h>
#ifndef MANX
#include	<proto/exec.h>
#include	<proto/intuition.h>
#endif
#include	<stdio.h>
#include	<string.h>
#ifndef MANX
#include	<stdlib.h>
#endif

extern struct Library *OpenLibrary();
extern struct IntuitionBase *IntuitionBase;
extern struct GfxBase *GfxBase;

/* AutoRequest data structures */
#define REDP 3
#define BLKP 2
#define WHTP 1
#define BLUP 0

static struct IntuiText questionText = {
   REDP,     WHTP,
   JAM2,
   5,			/* LeftEdge */
   5,			/* TopEdge  */
   NULL,		/* Default font */
   NULL,		/* Text (to be filled in) */
   NULL			/* No pointer to next text */
};
 
/** YES TEXT **/
static struct IntuiText yesText = {
   BLUP,  WHTP,
   JAM2,
   7,			/* LeftEdge */
   3,			/* TopEdge  */
   NULL,		/* Default font */
   (UBYTE *) "Yes",	/* Text */
   NULL			/* No pointer to next text */
};
 
/** NO TEXT **/
static struct IntuiText noText = {
   REDP,  WHTP,
   JAM2,
    7,			/* LeftEdge */
    3,			/* TopEdge  */
   NULL,		/* Default font */
   (UBYTE *) "No",	/* Text */
   NULL
};

initMachSpecific()
{
    if ((GfxBase = (struct GfxBase *) 
	 OpenLibrary("graphics.library", 0)) == 0) {
	fprintf(stderr,"Unable to open graphics.library\n");
	my_exit(20);
    }
    if ((IntuitionBase = (struct IntuitionBase *) 
	 OpenLibrary("intuition.library", 0)) == 0) {
	fprintf(stderr,"Unable to open intuition.library\n");
	my_exit(21);
    }
}

cleanMachSpecific()
{
    if (IntuitionBase)
        CloseLibrary((struct Library *) IntuitionBase);
    if (GfxBase)
        CloseLibrary((struct Library *) GfxBase);
}

simpleRequest(question)
char *question;
{
    questionText.IText = (UBYTE *) question;
    return(AutoRequest(0, &questionText, &yesText, &noText, 0, 0,
		       max(strlen(question)*8 + 34, 150), 60));
}

