|
|
#define M_TERMCAP #include <curses.h>OR #include <tcap.h>
char buffer[1024*3]; /* buffer [TCAP_BUFSIZ] */ char *bp = buffer;
int tgetent(char *bp, char *name); int tgetflag(char id[2]); int tgetnum(char id[2]); char *tgetstr(char id[2], char **area); char *tgoto(char *cap, int col, int row); int tputs(char *str, int affcnt, int (*pufunc)(int));
The tgetent( ) routine looks up the termcap entry for name, loading it into the buffer referenced by the buffer pointer bp. The referenced buffer has historically been 1K but here should be at least 2K (2048) because some of the termcap entries are this large. See ``Future directions''.
The tgetflag( ) routine gets the boolean entry for termcap boolean capability id.
The tgetnum( ) routine gets the numeric entry for termcap numeric capability id.
The tgetstr( ) routine returns the string entry for termcap string capability id. Use tparm( ) to instantiate and tputs( ) to output the returned string.
The tgoto( ) routine instantiates the cursor positioning parameters into the given (assumed cursor positioning) termcap capability. The returned ptr is to an internal static buffer and will be overwritten at the next invocation. The output from this routine should be passed to tputs( ).
The tputs( ) routine puts the character string str out, with padding as specified by the string. The number of affected lines is affcnt (or 1 if not applicable). putfunc is a routine like putchar(S) to which the characters are passed, one at a time, for actually doing the output.