//    ShellBack   $VER: v1.0 1992-04-28   E. Lundevall
//
//    Move the current shell window to the back

#include <exec/types.h>
#include <exec/memory.h>
#include <dos/dosextens.h>
#include <dos/rdargs.h>
#include <clib/exec_protos.h>
#include <clib/dos_protos.h>

#define ERRTXT (UBYTE *)"Couldn't open intuition.library!\n"
#define INTUINAME (UBYTE *)"intuition.library"
#define KS12 33


struct IntuitionBase *IntuitionBase;
UBYTE vertxt[] = "\0$VER: v1.0_1992-04-28";


extern struct MsgPort *MyGetConsoleTask();
extern struct Window  *GetWin(BPTR);


int main(void)
{
 struct Window *win;

 if(!MyGetConsoleTask())
	exit(10);       // Exit if no Shell.

 IntuitionBase = (struct IntuitionBase *)
                 OpenLibrary(INTUINAME,KS12);

 if(!IntuitionBase) {
	Write(Output(),ERRTXT,strlen(ERRTXT));
	exit(10);
 }

 if((win = GetWin(Output())) != NULL)
	WindowToBack(win);

 CloseLibrary((struct Library *)IntuitionBase);
 return 0;
}
