#include <newcurses.h>
#include <stdlib.h>
#include <stdio.h>
#define TBUFSIZE 2048
int xfputs(char *str, FILE *fp);
int
tcout(char *cap, FILE *tfp)
{
static init;
staticchar *term;
staticchar tbuf[TBUFSIZE], buf[TBUFSIZE], *bp = buf;
char *sv;
if (!init) {
init = 1;
term = getenv("TERM");
}
if (term == 0 || tgetent(&tbuf[0], term) != 1)
return 0;
if (sv = tgetstr(cap, &bp)) {
xfputs(sv, tfp);
return 1;
}
return 0;
}