[comp.lang.c] /dev/tty problem

dan@hrc.UUCP (Dan Troxel VP) (12/14/88)

Is there another dev/* that I can use to open the terminal io using rn?
The error I receive is as follows:
	Can't open /dev/tty
	No such device or address
Specifics:
	Convergent Tech S/640 running the CTAM 2.00 windowing software
	
Rn will work fine from a standard shell, but under the windowing application,
it gives me that above error.
-- 
Dan Troxel VP of Computer Operations @ 
Handwriting Research Corporation - 2821 E. Camelback Road Suite 600
Phoenix, AZ  85016       WK 1-602-957-8870        HM 1-602-435-1240
UUCP : asuvax!hrc!dan

jiii@visdc.UUCP (John E Van Deusen III) (12/17/88)

I once had a similar problem opening /dev/tty with a program that was
running in a pipe line but needed to fork an interactive shell every
so often.  In order to have access to the terminal, I invoked the
shell command exec </dev/tty >/dev/tty.  If I then attempted to su(1)
to another uid, the standard input would not be readable.  The reason
was that the permissions and ownerships from the previous uid had
somehow remained in effect.  The curious thing was that this would only
happen if the input and output had previously been redirected to pipes.
As I recall, exec 0<&2 1>&2 solved the problem, so I would suggest that
you dup(2) the standard error file file descriptor.  This has the added
advantage that /etc/ttytype remains useful.

bdb@becker.UUCP (Bruce Becker) (12/17/88)

In article <373@hrc.UUCP> dan@hrc.UUCP (Dan Troxel VP) writes:
>
>Is there another dev/* that I can use to open the terminal io using rn?
>The error I receive is as follows:
>	Can't open /dev/tty
>	No such device or address
>Specifics:
>	Convergent Tech S/640 running the CTAM 2.00 windowing software

	There is a similar problem in the windowing software for the
	AT&T 3B1 version of CTIX. In that system the problem occurs
	when "/dev/tty" is the internal modem; certain open flags
	determine the state of the opened device (whether data or
	voice use of the phone line in that case). Look in the terminal
	i/o section of the 'rn' source - I don't have it online at the
	moment, but I seem to recall "term" or something as the routine
	in question, in which "/dev/tty" is opened to a new file
	descriptor.  Check to see that 'O_RDONLY' mode doesn't have
	some special meaning for window systems which would be averted
	using 'O_RDWR' or similar.
	Perhaps this isn't the problem, but if it is, it takes some
	detective work (not mine in the 3B1 case) to find out.
	Good luck, in any case - 'rn' is a valuble resource...

>Rn will work fine from a standard shell, but under the windowing application,
>it gives me that above error.
>-- 
>Dan Troxel VP of Computer Operations @ 
>Handwriting Research Corporation - 2821 E. Camelback Road Suite 600
>Phoenix, AZ  85016       WK 1-602-957-8870        HM 1-602-435-1240
>UUCP : asuvax!hrc!dan

Cheers,
-- 
Bruce Becker        Toronto, Ont.
Internet: bdb@becker.UUCP, bruce@gpu.utcs.toronto.edu, becker@ziebmef.UUCP
BitNet:   BECKER@HUMBER.BITNET
"Paranoia is its own reward" - Lyon Bullroarey, honorary American