#include <stdlib.h>
#include <string.h>
#include <intuition/intuition.h>
#include <clib/intuition_protos.h>
#include <clib/exec_protos.h>
#include "Includes/MyAlert.h"

char const *version = "$VER: Alert V1.0 (28.05.93)";

struct IntuitionBase	*IntuitionBase;

main(int argc,char *argv[]) {
	if(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",33)) {
		if(argc<2 | strcmp(argv[1],"?")==0)
			MyAlert(RECOVERY_ALERT,
							"Alert V1.0  © 1993 Ketil Hunn\n"
							"Usage: Alert TEXTLINE/M\n\n"
							"Each given parameter will appear as one line of text "
							"in the alert.");
		else {
			int i=0;
			char	*text;

			if(text=malloc(2400)) {
				strcpy(text,argv[1]);
				for(i=2; i<argc; ++i) {
					strcat(text,"\n");
					strcat(text,argv[i]);
				}
				MyAlert(RECOVERY_ALERT,text);
				free(text);
			} else 
				MyAlert(RECOVERY_ALERT,"Out of memory!");
		}
		CloseLibrary((struct Library *)IntuitionBase);
	}
}
