dpv@spao.ao.gov (David Van Dyke) (06/05/91)
Hi Netlanders, I've got an easy one for you experienced folk. I'm running on a UNISYS 5000/90 (Motorola 68020 based) with system V r3.2 UNIX. My question is regarding trying to understand the stty -g output. Can anyone give me a clue as to how I can map a string like "526:1805:4bd:3b:7f:1c:8:18:4:0:0:0:0:0" to the appropriate flags (i.e. -parenb, -brkint, etc.) listed in TFM, or is that not how the stty -g works? E-mail to me, or postings to the net if you think its of general interest, would be welcome. Thanks in advance ============================================================================== || David P. Van Dyke, Computer Programmer Analyst || internet: || || Administrative Office of the United States Courts || dpv@spao.ao.gov || || || uucp: || || The opinions expressed here are exclusively my || uunet!spao!dpv || || own. The A. O. does not accept any responsibility || phone: || || for the contents herein. || (202) 786-6760 || ==============================================================================
djm@eng.umd.edu (David J. MacKenzie) (06/07/91)
> how I can map a string like "526:1805:4bd:3b:7f:1c:8:18:4:0:0:0:0:0" to > the appropriate flags (i.e. -parenb, -brkint, etc.) listed in TFM, > or is that not how the stty -g works? stty -g is just a hex dump of the current values of the tty's `struct termio[s]' members, in order, omitting c_line. Separated by colons, of course. -- David J. MacKenzie <djm@eng.umd.edu> <djm@ai.mit.edu>
torek@elf.ee.lbl.gov (Chris Torek) (06/07/91)
In article <DJM.91Jun6202241@egypt.eng.umd.edu> djm@eng.umd.edu (David J. MacKenzie) writes: >stty -g is just a hex dump of the current values of the tty's `struct >termio[s]' members, in order, omitting c_line. Separated by colons, >of course. Oh? % stty -g -gfmt:iflag=2b22:oflag=7:cflag=5a00:lflag=5cb:cc=4,377,377,10,27,30,22,377,3,34,32,31,21,23,26,17,1,0,24,377:ispeed=9600:ospeed=9600: % The output from `stty -g' is entirely private to the implementation, and may change from moment to moment. The only constraint on it is that a later stty with that output should restore the terminal modes (i.e., it has to contain enough information, in some arbitrary format, to do this). This is at least the second `stty -g' format that has been used on this machine. (A third produces `Bus error (core dumped)' at the moment, but never mind that :-) .) -- In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427) Berkeley, CA Domain: torek@ee.lbl.gov
barrett@Daisy.EE.UND.AC.ZA (Alan P Barrett) (06/11/91)
In article <14013@dog.ee.lbl.gov>, torek@elf.ee.lbl.gov (Chris Torek) writes: > The output from `stty -g' is entirely private to the implementation, > and may change from moment to moment. The only constraint on it is that > a later stty with that output should restore the terminal modes (i.e., > it has to contain enough information, in some arbitrary format, to do > this). Ah, but how much later? Is the output of one stty -g allowed to be kept somewhere and fed to another stty later, after the implementation has changed? How often is the implementation allowed to change? I can do a {mv my-new-and-improved-stty /bin/stty} any time, and thereby change the implementation of stty instantaneously. Now what happens to the remembered output of the old stty -g? Is it still expected to work? If so then surely there _should_ be a standard format (or at least a standard lowest common denominator). If the format is not expected to work from one implementation to another, then how can an application rely on being able to do {flags=`stty -g`; blah blah blah; stty $flags}? It seems that we cannot rely even on {stty `stty -g`} because the implementation of stty could change during the execution of the command. --apb Alan Barrett, Dept. of Electronic Eng., Univ. of Natal, Durban, South Africa RFC822: barrett@ee.und.ac.za Bang: m2xenix!quagga!undeed!barrett
guy@auspex.auspex.com (Guy Harris) (06/17/91)
>Ah, but how much later? Is the output of one stty -g allowed to be kept >somewhere and fed to another stty later, after the implementation has >changed? Probably not. I wouldn't be surprised, for example, if the "stty -g" output from System V prior to S5R4 wasn't acceptable to S5R4, as S5R4 has more tty driver state to save and restore, although the S5R4 "stty" might be able to recognize when it's been handed old-style state information and do something reasonable. >How often is the implementation allowed to change? I've never seen a manual page that specified that. >I can do a {mv my-new-and-improved-stty /bin/stty} any time, >and thereby change the implementation of stty instantaneously. You could also do "rm /bin/*", given that you have permission to write in "/bin" (or whatever "/bin" is a link to, if it is such), and change a hell of a lot more than just the implementation of "stty"; the system shouldn't necessarily be prepared for *everything* a sufficiently-privileged user can do. >Now what happens to the remembered output of the old stty -g? Is it >still expected to work? I wouldn't assume it'd work; you, or whoever created the "new and improved" "stty", would be best advised to try to make the "new and improved" program deal with the old "stty -g" output format, but there's not much that could enforce that. >If the format is not expected to work from one implementation to >another, then how can an application rely on being able to do >{flags=`stty -g`; blah blah blah; stty $flags}? It seems that we cannot >rely even on {stty `stty -g`} because the implementation of stty could >change during the execution of the command. Yes, and some natural disaster could strike the computer center, too, and level it to the ground. You can't *rely* on somebody not screwing up and dropping in an incompatible "stty" command while the system is still running, but you can get a lynch mob together after it's been done and track the person down; hopefully, that will act as a sufficient incentive to prevent people from installing incompatible versions of "stty" - which is probably quite unlikely to happen on 99 44/100% of all sites, at least not without a new version of the OS being installed, which generally requires the system to be shut down, and most applications that use "stty -g" probably don't save the settings to a file and restore them later. Those that do may be screwed, but that's life.