#include "mince.gbl"

TINIT()
{

	char *p;

	tbuf = getmem(128);
	if(tgetent(tbuf) == 0){
		puts("Terminal database file corrupted\n");
		exit(1);
	}
	
	p = terminal.termbuf;
	terminal.bell = "\007";
	terminal.nrows = tgetnum("li");
	terminal.ncols = tgetnum("co");
	terminal.CM = tgetstr("cm", &p);
	terminal.CE = tgetstr("ce", &p);
	terminal.CL = tgetstr("cl", &p);
	rlsmem(tbuf, 128);
}

TPOSN(row, col)
int row, col;
{

	char *cursor;

	cursor = tgoto(terminal.CM, col - 1, row - 1);
	tputs(cursor);
}

AsTCLEOL()
{

	tputs(terminal.CE);
}

AsTCLEOS(){

	tputs(terminal.CL);
}

tputs(string)
char *string;
{

	while(*string)
		putch(*string++);
}

TREV()
{
}

TNORM()
{
}
