/* $Id: malert.m,v 1.1 1997/10/27 01:02:50 lukeh Exp $ */

#if NS_TARGET_MAJOR < 4
#import <libc.h>
#import <appkit/appkit.h>

void main(int argc, char*argv[])
{
	printf("\7");
	fflush(stdout);

	NXApp = [Application new];

	
	if (argc > 2)
		NXRunAlertPanel(argv[1], argv[2], "OK", NULL, NULL);

	[NXApp free];

	exit(0);
}
#else
#import <Foundation/Foundation.h>
#import <AppKit/AppKit.h>
void main(int argc,char **argv){
	NSAutoreleasePool *puddle = [[NSAutoreleasePool alloc]init];

	printf("\7");
	fflush(stdout);
	NSApp = [NSApplication sharedApplication];
	if (argc > 2) {
		id panel = NSGetInformationalAlertPanel([NSString stringWithCString:argv[1]],
			[NSString stringWithCString:argv[2]], @"OK", nil, nil);
		NSModalSession session = [NSApp beginModalSessionForWindow:panel];
		for (;;) {
			if ([NSApp runModalSession:session] != NSRunContinuesResponse)
				 break;
			}
		[NSApp endModalSession:session];
	}
	[puddle release];
	exit(0);
}
#endif

