TIOCSTI vs SunOS 4.x

Guy Harris guy at auspex.auspex.com
Sun Mar 17 06:10:42 AEST 1991


>I find that using TIOCSTI to push back the literal-next character is
>broken.  On real Berkeley, doing this does what one would expect: the
>next character typed is literal-nexted.  On SunOS 3.5, it works the
>same way.  But under releases 4.0.3, 4.1, and 4.1.1, at least, doing
>this causes the pushed-back literal-next to quote itself somehow,
>rather than quoting the next character typed.

Well, SunOS 4.x's tty drivers (yes, "drivers"; in 4.x, TIOCSTI is
implemented by the device driver, not by "ldterm") implement TIOCSTI by
sending the character in question upstream as if it had arrived as
input, which makes it unlikely that it would be broken in the fashion
you describe.

However, just to make sure, I tested it, with the following program:

	#include <termios.h>

	main()
	{
		struct termios termios;
	
		if (ioctl(1, TCGETS, &termios) < 0) {
			perror("TCGETS");
			return 2;
		}
	
		if (ioctl(1, TIOCSTI, &termios.c_cc[VLNEXT]) < 0) {
			perror("TIOCSTI VLNEXT");
			return 2;
		}
	
		if (ioctl(1, TIOCSTI, &termios.c_cc[VERASE]) < 0) {
			perror("TIOCSTI VERASE");
			return 2;
		}
	
		return 0;
	}

and, as I'd expected, after running that program in cooked mode under
the C shell, a DEL appeared as input (DEL being my erase character).

Under what circumstances did you get the behavior you describe?



More information about the Comp.unix.questions mailing list