Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!cica!iuvax!watmath!watcgl!idallen
From: idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL])
Newsgroups: comp.unix.ultrix
Subject: Re: can't do stty speed into a pipe or file on Ultrix 3.x
Message-ID: <11599@watcgl.waterloo.edu>
Date: 25 Sep 89 02:19:15 GMT
References: <11582@watcgl.waterloo.edu>
Reply-To: idallen@watcgl.waterloo.edu (Ian! D. Allen [CGL])
Distribution: comp
Organization: U. of Waterloo, Ontario
Lines: 23

Let me clarify, for those who think I don't understand stty:

    > % stty speed
    > 9600
    > % set speed=`stty speed`
    > stty: : Not a typewriter
    > 
    > Sure makes it hard to use stty to get your terminal baud rate.

Looking at the Ultrix 3.1 stty source, I confirmed that all ioctl calls
are done on unit 1 (stdout), with almost all stty output going on unit 2
via fprintf(stderr...).  The "size" and "speed" options are the two
exceptions.  Both of these try to open /dev/tty to do the ioctl and use
plain printf to print on unit 1 (stdout) rather than unit 2 (stderr).

But stty aborts long before it gets to try opening /dev/tty, because it
always tries to do an ioctl on unit 1 first, and dies.

Hence, you can't redirect the printf without also redirecting the source
of the unit 1 ioctl and causing stty to abort immediately.
-- 
-IAN! (Ian! D. Allen) idallen@watcgl.uwaterloo.ca idallen@watcgl.waterloo.edu
 129.97.128.64    Computer Graphics Lab/University of Waterloo/Ontario/Canada