#define	rsts	1
#include <stdio.h>
#include <rsts.h>

extern	$$opsy;
typedef	int	(*fncp) ();
#define	__exit	(* ((fncp) 0))

$$exit()
{
    exit();
}

int	$$exst = 0;
exit()
{
    if ($$opsy == 7) {	/* If we're in the RT11 emulator		*/
        __exit();	/* Exit by jumping to the CLR R0/.EXIT at 0,2	*/
    }
    clrfqx();
    rstsys(_RTS);
    rstsys(_EXIT);
}

$$fail()
{
    if ($$opsy == 7) {	/* If we're in the RT11 emulator		*/
        __exit();	/* Exit by jumping to the CLR R0/.EXIT at 0,2	*/
    }
    clrfqx();
    rstsys(_RTS);
    rstsys(_EXIT);
}
