#ifdef SECURE
#import <c.h>
#import <stdio.h>
#import <appkit/Panel.h>
#import <cryptsum.h>
#endif

#import "MyApp.h"

void main(int argc, char *argv[])
{
	int status = EXIT_SUCCESS;	
#ifdef SECURE
	char *message = NULL;

	switch(status = cs_checkkey("__TEXT", "__text", PASSWORD)) {
		case CS_SUCCESS : break;
		case CS_NOENTRY : message = "No checksum entry present!"; break;
		case CS_NOSECTION : message = "Attempt to checksum nonexistant section!"; break;
		case CS_NOCHECKSUM : message = "No checksum information available!"; break;
		case CS_NOMATCH : message = "Checksum invalid!"; break;
		case CERROR :
		default : message = "Unknown system error in checksum routine!"; break;
		}
#endif

	NXApp = [MyApp new]; /* Need Application object to use NXRunAlertPanel */
	
#ifdef SECURE
	if(status == CS_SUCCESS) {
#endif
		[NXApp loadNibSection:"MyApp.nib" owner:NXApp];
		[NXApp run];
#ifdef SECURE
		status == EXIT_SUCCESS;
		}
	else {
		(void) NXRunAlertPanel(NULL, message, NULL, NULL, NULL);
		status = EXIT_FAILURE;
		}
#endif	
	[NXApp free];
		
	exit(status);
}
