/*	@(#)termios.h	13.5 (RC International) 91/08/30	 */

/*
 * This file contains definitions for the termios interface to terminals. 
 */

#ifndef _TERMIOS_H
#define _TERMIOS_H

typedef unsigned long tcflag_t;
typedef unsigned char cc_t;
typedef unsigned long speed_t;

/*
 * Control characters in addition to those in termio.h.
 *
 * Number of characters in termios.c_cc table.
 */
#define	NCCS	20
/*
 * The names and indexes of control characters 0-12
 * in the termios.c_cc table are in termio.h.
 */
#define	VSTART		13
#define	VSTOP		14
#define	VLNEXT		15
#define	VDISCARD	16
#define VWERASE		17
#define	VREPRINT	18
#define	VDSUSP		19

#include <sys/termio.h>

/*
 * Terminal control structure.
 */
struct termios {
	tcflag_t	c_iflag;	/* input modes */
	tcflag_t	c_oflag;	/* output modes */
	tcflag_t	c_cflag;	/* control modes */
	tcflag_t	c_lflag;	/* line discipline modes */
	cc_t		c_cc[NCCS];	/* control chars */
};

#define _POSIX_VDISABLE	0	/* Disable special character functions */

#ifndef _POSIX_SOURCE
#define	CCEQ(val, c)	(c == val ? val != _POSIX_VDISABLE : 0)
#endif

/* 
 * termios functions; get mapped into ioctls.
 */
#if defined(__STDC__)

extern speed_t cfgetospeed (struct termios *);
extern int cfsetospeed (struct termios *, speed_t);
extern speed_t cfgetispeed (struct termios *);
extern int cfsetispeed (struct termios *, speed_t);
extern int tcgetattr (int, struct termios *);
extern int tcsetattr (int, int, struct termios *);
extern int tcsendbreak (int, int);
extern int tcdrain (int);
extern int tcflush (int, int);
extern int tcflow (int, int);

#else /* Not __STDC__ */

extern speed_t cfgetospeed ();
extern int cfsetospeed ();
extern speed_t cfgetispeed ();
extern int cfsetispeed ();
extern int tcgetattr ();
extern int tcsetattr ();
extern int tcsendbreak ();
extern int tcdrain ();
extern int tcflush ();
extern int tcflow ();

#endif /* __STDC__ */

#endif /* _TERMIOS_H */
