🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: net.bugs
Article #265

Why 4BSD 'stty' uses stdout instead of stdin

#265
From: Donn Seeley
Date: Mon, 13 Aug 1984 23:26
30 lines
2222 bytes
From Guy Harris (guy@rlgvax.UUCP):

	The USG UNIX solution is, I think, better; the USG "stty"
	command acts on its standard *input*.

There is a reason for the curious behavior of the Berkeley 'stty', as
I'm sure Guy knows, and it's probably useful to mention it in passing.
On 4BSD (and V7?) a tty must be opened for writing in order for a
process to set the tty's modes.  This does make a certain amount of
sense; if you don't want someone to write on your tty, then you usually
don't want them to set your tty's mode either.  It was decided that it
was simpler to get and set modes on the same descriptor, hence the
output to stderr and so on.

I'm not sure how USG Unix handles this: does the tty merely have to be
writable, as opposed to being opened for writing?  Does 'stty' get
modes from stdin and set them on stdout?  Does it care how the
descriptor was obtained?  The second of these alternatives (get stdin,
set stdout) would work on 4BSD...  If there was a '-c' option for
copying modes, you could perhaps say 'stty -c < /dev/ttyz1 >
/dev/ttyz2' and copy the modes from one tty to another.  'stty -g'
sounds useful, except that the output of 'stty' is already so close to
being input to 'stty' that it's a pity (ouch) it wasn't extended a
little farther so that 'stty < /dev/ttyz1 > file; stty `cat file` >
/dev/ttyz2' could work.

More wishful thinking,

Donn Seeley    University of Utah CS Dept    donn@utah-cs.arpa
40 46' 6"N 111 50' 34"W    (801) 581-5668    decvax!utah-cs!donn
Technical Details
Message-ID: <2993@utah-cs.UUCP>
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!mgnetp!ihnp4!zehntel!hplabs!hao!seismo!utah-cs!donn
References: <895@trwrb.UUCP> <1228@dalcs.UUCP> <747@dual.UUCP> <46@rlgvax.UUCP> <318@wucs.UUCP> <5024@utcsrgv.UUCP> <2540@mit-eddie.UUCP>

Show Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site utah-cs.UUCP
Path: arc1-ca.pugleaf.net!utzoo!watmath!clyde!burl!mgnetp!ihnp4!zehntel!hplabs!hao!seismo!utah-cs!donn
From: donn@utah-cs.UUCP (Donn Seeley)
Newsgroups: net.bugs,net.unix
Subject: Why 4BSD 'stty' uses stdout instead of stdin
Message-ID: <2993@utah-cs.UUCP>
Date: Mon, 13-Aug-84 19:26:43 EDT
Article-I.D.: utah-cs.2993
Posted: Mon Aug 13 19:26:43 1984
Date-Received: Wed, 15-Aug-84 06:35:49 EDT
References: <895@trwrb.UUCP> <1228@dalcs.UUCP> <747@dual.UUCP> <46@rlgvax.UUCP> <318@wucs.UUCP> <5024@utcsrgv.UUCP> <2540@mit-eddie.UUCP>
Organization: University of Utah CS Dept
Lines: 30