#include <exec/types.h>
#include <intuition/intuition.h>
#include <proto/dos.h>
#include <proto/exec.h>
#include <proto/intuition.h>

#define PRIVATESCREE
#ifdef PRIVATESCREEN
struct TextAttr MyFont = { "topaz.font",TOPAZ_EIGHTY,FS_NORMAL,FPB_ROMFONT };

struct NewScreen MyScreen = {
	0,0,640,256,3,0,1,
	HIRES,CUSTOMSCREEN,&MyFont,
	"Min Test Screen....",
	NULL
};
#endif

extern void _exit(int errcode);
extern void tprintf(char *fmtstr,...);
extern int getfile(struct Screen *s,BPTR dirlock,UBYTE *okname,char *filenameptr);
void main(void);

void main(void)
{
	char filename[256];
	register int rcode;
#ifdef PRIVATESCREEN
	register struct Screen *ms;
#endif

	if (IntuitionBase == NULL)
		if ((IntuitionBase = (struct IntuitionBase *)OpenLibrary("intuition.library",0)) == NULL)
			_exit(20);

#ifdef PRIVATESCREEN
	if ((ms = OpenScreen(&MyScreen)) == NULL)
		goto abort;

	if ((rcode = getfile(ms,((struct Process *)FindTask(NULL))->pr_CurrentDir,"Load",filename)) != NULL) {
#else
	if ((rcode = getfile(NULL,((struct Process *)FindTask(NULL))->pr_CurrentDir,"Load",filename)) != NULL) {
#endif
		if (rcode == 1)
			tprintf("Canceled!\n");
		else
			tprintf("Dir error!\n");
	}
	else
		tprintf("Got '%ls' as filename.\n",filename);

#ifdef PRIVATESCREEN
	CloseScreen(ms);
#endif

abort:
	CloseLibrary((struct Library *)IntuitionBase);
	_exit(0);
}
