CBREAK on SCO XENIX

Tim Iverson iverson at xstor.UUCP
Wed Jul 25 05:39:41 AEST 1990


In article <173 at n4hgf.Mt-Park.GA.US> wht at n4hgf.UUCP (Warren Tucker) writes:
>> [paraphrased] What's CBREAK?  What's the UNIX equivilant for it?
>
>CBREAK may be found but it is also unsupported :-).
>It is a "half-cooked" mode found in BSD.  CBREAK made it into
>XENIX sgtty.h, but I have never been able to get it to work.

It's used mostly to unbuffer tty input so that programs can get a key as it
is typed (e.g. rn, emacs, vi, jove, etc. all use cbreak mode or its
equivilent).  Under Xenix, support for this is provided via the termio 
library calls as follows (see the termio manual entry for details):

{
	struct termio	t;
	int		gotkey;
	char		key;

	/* NB - on a real implementation, you should also
	 *	save the current setting to restore before you leave.
	 */
	ioctl(0, TCGETA, &t);		/* get current settings */
	t.c_iflag &= ~ICANON;		/* turn off editing & line buffering */
	t.c_cc[VMIN] = 1;		/* return at least 1 char, */
	t.c_cc[VTIME] = 0;		/*   but don't wait for more chars */
	ioctl(0, TCSETA, &t);

	gotkey = read(0, key, 1) == 1;	/* get just one key */
}

>Warren Tucker, TuckerWare   emory!n4hgf!wht or wht at n4hgf.Mt-Park.GA.US
>"It was electrons that brought down the Berlin Wall." -- Timothy Leary

- Tim Iverson
  uunet!xstor!iverson



More information about the Comp.unix.xenix mailing list