/*	$OpenBSD: term.h.tail,v 1.3 1996/12/09 01:18:18 tholo Exp $	*/

/*
 * Copyright (c) 1996 SigmaSoft, Th. Lockert <tholo@sigmasoft.com>
 * All rights reserved.
 */

typedef struct _terminal {
    int			 fd;
    speed_t		 baudrate;
    struct termios	 pmode;
    struct termios	 smode;
    char		*name;
    char		*names;
    char		 bools[_tBoolCnt];
    short		 nums[_tNumCnt];
    char		*strs[_tStrCnt];
} TERMINAL;

#define Filedes fd
#define Ottyb smode
#define Nttyb pmode
#define TTY struct termios

#ifndef _CHTYPE_T_
#define	_CHTYPE_T_	unsigned long
typedef _CHTYPE_T_	chtype;
#endif

#undef fixterm
#undef putp
#undef resetterm
#undef setterm
#undef vidattr

__BEGIN_DECLS
extern const char * const boolnames[];
extern const char * const boolcodes[];
extern const char * const boolfnames[];
extern const char * const numnames[];
extern const char * const numcodes[];
extern const char * const numfnames[];
extern const char * const strnames[];
extern const char * const strcodes[];
extern const char * const strfnames[];

extern int	 LINES;
extern int	 COLS;
extern int	 TABSIZE;
extern TERMINAL	*cur_term;
extern char	 ttytype[];

int	 def_prog_mode __P((void));
int	 def_shell_mode __P((void));
int	 del_curterm __P((TERMINAL *));
int	 mvcur __P((int, int, int, int));
int	 putp __P((const char *));
int	 reset_prog_mode __P((void));
int	 reset_shell_mode __P((void));
int	 restartterm __P((const char *, int, int *));
int	 setupterm __P((const char *, int, int *));
int	 setterm __P((const char *));
TERMINAL *set_curterm __P((TERMINAL *));
int	 tigetflag __P((const char *));
int	 tigetnum __P((const char *));
char	*tigetstr __P((const char *));
char	*tparm __P((const char *, ...));
int	 tputs __P((const char *, int, int (*)(int)));
int	 tgetent __P((char *, const char *));
int	 tgetflag __P((const char *));
int	 tgetnum __P((const char *));
char	*tgetstr __P((const char *, char **));
char	*tgoto __P((const char *, int, int));
void	 use_env __P((int));
int	 vidattr __P((chtype));
int	 vidputs __P((chtype, int (*)(int)));

int	 _ti_outc __P((int));
__END_DECLS

#define fixterm()	reset_prog_mode()
#define putp(s)		tputs(s, 1, _ti_outc)
#define resetterm()	reset_shell_mode()
#define setterm(term)	setupterm(term, 1, (int *)0)
#define	vidattr(s)	vidputs(s, _ti_outc)

#ifndef OK
#define	OK	(0)
#endif /* OK */

#ifndef ERR
#define	ERR	(-1)
#endif /* ERR */

#ifndef TRUE
#define	TRUE	(1)
#endif

#ifndef FALSE
#define FALSE	(0)
#endif

#ifndef A_ATTRIBUTES
#define A_ATTRIBUTES	0xffffff00
#define A_NORMAL	0x00000000
#define A_STANDOUT	0x00010000
#define A_UNDERLINE	0x00020000
#define A_REVERSE	0x00040000
#define A_BLINK		0x00080000
#define A_DIM		0x00100000
#define A_BOLD		0x00200000
#define A_ALTCHARSET	0x00400000
#define A_INVIS		0x00800000
#define A_PROTECT	0x01000000
#define A_HORIZONTAL	0x02000000
#define A_LEFT		0x04000000
#define A_LOW		0x08000000
#define A_RIGHT		0x10000000
#define A_TOP		0x20000000
#define A_VERTICAL	0x40000000
#define A_CHARTEXT	0x000000ff
#define A_COLOR		0x0000ff00
#endif

#endif /* _TERM_H_ */