/* TERMLIB: Terminal independant database.
 *
 * Module: tinit
 *
 * Purpose: simplified terminal initialisation.
 *
 * Calling conventions: name is name of terminal.
 *
 * Returned values: none.
 *
 * Notes
 *		tinit calls tgetent, then sets up the global
 *	variables PC, UP, BC, ospeed appropriately.
 *
 */
#include "termlib.h"
#include <stdio.h>
#if !AMIGA
#include <sgtty.h>
#endif

/* tinit.c (libtermlib.a)
 *
 */

char tbuf[1024];                                /* Buffer for termcap entry */
char junkbuf[1024];                                  /* Big buffer for junk */
char *junkptr;

tinit(name)
char *name;
{
#if !AMIGA
	struct sgttyb sgbuf;
#endif
	char *ps;

	junkptr = junkbuf;

	tgetent(tbuf, name);

	ps = tgetstr("pc", &junkptr);
	if(ps) PC = *ps;
	UP = tgetstr("up", &junkptr);
	BC = tgetstr("bc", &junkptr);

#if AMIGA
	ospeed=0;
#else
	gtty(1, &sgbuf);
	ospeed=sgbuf.sg_ospeed;
#endif
}
