/*
          Treq - Enable/disable AmigaDOS requesters.

          Original effort by Fabio Rossetti.

	  (c) 1989 by Fabio Rossetti

	  To compile under Lattice C v5.0x use:

		LC -cus -v treq.c
		BLINK lib:arpc.o treq.o TO treq LIB lib:arp.lib lib:lc.lib

*/

#include <exec/types.h>
#include <exec/exec.h>
#include <exec/libraries.h>
#include <libraries/dos.h>
#include <libraries/dosextens.h>
#include <libraries/arpbase.h>
#include <arpfunctions.h>
#include <proto/exec.h>

struct Process *Pr;
struct ArpBase *ArpBase;

/* tricks */

VOID MemCleanup()
{
}

/*
   _main() used instead of main() to override unnecessary ARP parser and
   keep down code size.
*/

VOID _main() 
{

	Pr = (struct Process *)FindTask(NULL);

	if(!(ArpBase = (struct ArpBase*)OpenLibrary(ArpName,ArpVersion))){
		Pr->pr_Result2=ERROR_INVALID_RESIDENT_LIBRARY;
		exit(RETURN_FAIL);
		}


	
	
	if (Pr->pr_WindowPtr==(APTR)-1) 
		{
			Pr->pr_WindowPtr=NULL;
			Puts("Requesters for this Console Process are now ON\n");
		}
	else
		{
			Pr->pr_WindowPtr=(APTR)-1;
			Puts("Requesters for this Console Process are now OFF\n");
		}
	CloseLibrary((struct Library*)ArpBase);		
}


