/*	XWPMSG.C
**
**	Message and Error-Handling Routines for XWP
*/

#include "a:stdio.h"
#include "b:oxege.h"

char FLerror;
char tempfn[15];

initmsg()
	{
	fill( 23, 0, 23, 79, ' ' | ATTINV, ATTDIM );
	cpoke( 23, 10, 62 | ATTINV, ATTDIM | ATTALT );
	cpoke( 23, 40, 62 | ATTINV, ATTDIM | ATTALT );
	cpoke( 23, 70, 62 | ATTINV, ATTDIM | ATTALT );
	}

message( area, inverse, string )
	int area, inverse;
	char *string;
	{
	int inv, scolumn, ecolumn;
	switch( area )
		{
		case 1:
			scolumn = 0;
			ecolumn = 9;
			break;
		case 2:
			scolumn = 11;
			ecolumn = 39;
			break;
		case 3:
			scolumn = 41;
			ecolumn = 69;
			break;
		}
	inv = NULL;
	if ( inverse == NULL ) { inv = ATTINV; }
	fill( 23, scolumn, 23, ecolumn, ' ' | inv, ATTDIM );
	if( inv ) { inv = 1; }
	spoke( 23, scolumn+1, string, ATTDIM ); 
	}

/*	ERROR - PRINT ERROR MESSAGE
*/
error( string )
	char string[];
	{
	FLerror = 255;
	savewindow( 23, 0, 23, 40, 0, 4 );
	fill( 23, 1, 23, 9, ' ' | ATTINV, ATTDIM );
	fill( 23, 12, 23, 39, ' ' | ATTINV, ATTDIM );
	spoke( 23, 1, " SORRY ", ATTBRT | ATTBLK | INVATT );
	spoke( 23, 12, string, ATTDIM );
	wait( 1 );
	savewindow( 23, 0, 23, 40, 1, 4 );
	}

/*	CHECK - SEE IF A FILE EXISTS
*/
check( file )
	char file[];
	{
	char *pointer;
	strcpy( tempfn, file );
	pointer = tempfn;
	while( *pointer != NULL )
		{
		if ( *pointer == ' ' )
			{
			*pointer = NULL;
			}
		++pointer;
		}
	strcat( tempfn, ".com" );
	if ( fopen( tempfn, "r" ) == NULL )
		{
		strcpy( scratch, tempfn );
		strcat( scratch, " NOT FOUND" );
		error( stoupper( scratch ) );
		}
	}
 ) == NULL )
	