/* termcap... print current terminal capabilities.
 *
 * Termcap prints all the termcap capability strings for the terminal `term'.
 * The output is in machine readable form, suitable for use in the construct:
 *
 *    TERMCAP="`termcap`"; export TERMCAP
 *
 * Syntax: termcap [term]
 */
#include <stdio.h>

char *tent;
main(ac, av)
int ac;
char **av;
{
	char tbuf[1024];
	if(ac==1) if(tgetent(tbuf, getenv("TERM"))) {
		puts(tbuf);
		exit(0);
	} else exit(-1);
	if(tgetent(tbuf, av[1])) {
		puts(tbuf);
		exit(0);
	} else exit(-1);
}
