stty -g output ...

Guy Harris guy at auspex.auspex.com
Fri Jun 21 10:41:35 AEST 1991


>Nobody expects Unix to be able to preempt usrs, but there is no *good* reason
>the stty command should not output a recognisable, STANDARD format (which was
>described in the manual pages).  Then it would not matter that the stty
>command was replaced by the new, improved version while the system was
>running.  And there would be no need to rely on word-of-mouth, "second guess"
>opinions that may or may not work with your version of Unix.

Umm, do you mean that *all* versions should use the same format?  If so,
it'd better be a format that:

	1) works on systems with

		#define	NCC	8

		struct termio {
			unsigned short	c_iflag;	/* input modes */
			unsigned short	c_oflag;	/* output modes */
			unsigned short	c_cflag;	/* control modes */
			unsigned short	c_lflag;	/* line discipline modes */
			char	c_line;			/* line discipline */
			unsigned char	c_cc[NCC];	/* control chars */
		};

	   (pre-SVR4 S5);

	2) works, *without change*, on systems with:

		#define	NCCS	17

		struct termios {
			unsigned long	c_iflag;	/* input modes */
			unsigned long	c_oflag;	/* output modes */
			unsigned long	c_cflag;	/* control modes */
			unsigned long	c_lflag;	/* line discipline modes */
			char		c_line;		/* line discipline XXX */
			unsigned char	c_cc[NCCS];	/* control chars */
		};

	   (i.e., uses the *exact same format* as the previous one, and
	   *without* losing information);

	   (SunOS 4.1; S5R4 is similar, if not identical)

	3) *also* works on systems with:

		#define	NCCS		20
		typedef unsigned long	tcflag_t;
		typedef unsigned char	cc_t;

		struct termios {
			tcflag_t	c_iflag;	/* input flags */
			tcflag_t	c_oflag;	/* output flags */
			tcflag_t	c_cflag;	/* control flags */
			tcflag_t	c_lflag;	/* local flags */
			cc_t		c_cc[NCCS];	/* control chars */
			long		c_ispeed;	/* input speed */
			long		c_ospeed;	/* output speed */
		};

	    (4.3-reno and probably 4.4BSD).

If no such format is possible, that kills the idea of making it
universal to all UNIX systems (or POSIX systems, if you've decided to
consider some or all of the above "not UNIX systems").

If you didn't mean "one universal format", bear in mind that once you've
put something in writing, it could be Very Hard to undo it; for example,
if S5R3 had Put It In Writing, it might have been difficult to change
for S5R4 (I'm assuming here that they *did* change it for S5R4).

The other question then is "under what circumstances would some program
or script care about the format?"  If the script wants to know whether
"echo" is on, for example, it should do a *normal* "stty" and see if the
right string appears in the output (it's more than a simple "grep", as
you have to worry about "echoe" and the like). 



More information about the Comp.unix.questions mailing list