[comp.sys.ibm.pc.rt] How to port sgttyb in BSD4.3 application to termio in sysV rel 2

gerards@econ.vu.nl (Gerard Strijdveen) (07/23/90)

The application I try to port has to read in ascii lines at 1200baud,
7 databits, 1 stopbit even parity. The lines all end with 'Carriage Return'.
What is de sysV rel 2 code for the underneath routine (used in BSD4.3)?
------------------------------------------------------
/* set speed etc. of communication line */

open_line()
{
	struct	sgttyb	ttybuf;

	close(0);
	if(fdc = open("/dev/ttyd0", 0) < 0) return(0);
	if(ioctl(0, TIOCEXCL, (char *)0) < 0 ||
		ioctl(0, TIOCGETP, (char *)&ttybuf) < 0) return(0);
	ttybuf.sg_ispeed = B1200;
	ttybuf.sg_flags = 0;
	ttybuf.sg_flags |= XTABS|ECHO|FF1|CRMOD;
	if(ioctl(0, TIOCSETP, (char *)&ttybuf) < 0) return(0);
	return(1);
}
------------------------------------------------------

AS you will expect, I am not an experienced C programmer and certainly not
when serial lines handling is the topic.

Please email directly to me:    gerards@econ.vu.nl