/* tcout.c - tcout */ /* gcc 2.8.1 on Solaris 2.6 doesn't seem to have this * file. Instead, it has curses.h X.Meng apr-10-1999 * #include */ #include #include #include #define TBUFSIZE 2048 int xfputs(char *str, FILE *fp); /*------------------------------------------------------------------------ * tcout - print the indicated terminal capability on the given stream *------------------------------------------------------------------------ */ int tcout(char *cap, FILE *tfp) { static init; static char *term; static char 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; }