can't do stty speed into a pipe or file on Ultrix 3.x

Ian! D. Allen [CGL] idallen at watcgl.waterloo.edu
Mon Sep 25 12:19:15 AEST 1989


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 at watcgl.uwaterloo.ca idallen at watcgl.waterloo.edu
 129.97.128.64    Computer Graphics Lab/University of Waterloo/Ontario/Canada



More information about the Comp.unix.ultrix mailing list