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

extern int day, month, year, jdate;
extern int dm[], dpm[];
extern int *FLchain;
char stdate[35], scratch[50], FLcalendar;

getstd()
	{
	getdate();
	strcat( stdate, swkday( nwkday( jdate ) ) );
	strcat( stdate, " " );
	itoa( day, scratch );
	strcat( stdate, scratch ); 
	strcat( stdate, " " );
	strcat( stdate, smonth( month ) );
	strcat( stdate, " " );
	itoa( year, scratch );
	strcat( stdate, scratch );
	}

#define CLINE	11
#define CCOL	1

calendar()
	{
	int line, cday, wday, ly;
	line = 0;
	*(FLchain - 2) = 255;
	outline( CLINE, CCOL, CLINE+10, CCOL+23, 
		OUTBLK, ATTDIM | ATTALT );
	fill( CLINE+1, CCOL+1, CLINE+1, CCOL+22, ' ' | ATTINV,  ATTDIM );
	fill( CLINE+2, CCOL+1, CLINE+9, CCOL+22, ' ', ATTBRT );
	getdate();
	itoa( year, scratch );
	spoke( CLINE+1, CCOL+1+((25-(strlen(smonth(month))+7))/2),
		smonth(month), ATTDIM );
	spoke( CLINE+1, 
	  CCOL+2+((25-(strlen(smonth(month))+7))/2)+strlen(smonth(month)),
	  scratch, ATTDIM );
	cday = 1;
	day = 1;
	ctoj();			/* Now we have first of month	*/
	wday = nwkday( jdate );
	getdate();		/* Restore current date 	*/
	while ( cday <= dm[ month - 1 ] )
		{
		putnum( cday, CLINE+3 + line, CCOL+2 + (wday * 3) );
		++wday;
		if (wday == 7) 
			{ 
			wday = 0; 
			++line;
			}
		++cday;
		}
	}

putnum( n, l, c )
	int n, l, c;
	{
	char att1, att2;
	att1 = NULL;
	att2 = ATTBRT;
	if (n == day)
		{	
		att1 = ATTINV;
		att2 = ATTDIM | ATTUND;
		}
	if (n < 10 )	
		{ 
		cpoke( l, c, ' ', ATTBRT ); 
		}
	else	
		{ 
		cpoke( l, c, ((n / 10) + '0') | att1, att2 ); 
		}
	cpoke( l, c+1, ((n % 10) + '0') | att1, att2 );
	}

clrcal()
	{
	*(FLchain - 2) = 0;
	fill( CLINE, CCOL, CLINE+10, CCOL+29, FILL1, ATTDIM | ATTALT );
	}

t1, att2 );
	}

clrcal()
	{
	*(FLchain - 2) = 0;
	fill( CLINE, CCOL, CLINE+10, CCOL+29, FILL1, ATTDIM | 