[comp.sys.sun] finding my login tty

meulenbr@uunet.uu.net (Frans Meulenbroeks) (03/23/89)

Hi!

Is there a way to detect your login tty?  ttyname(3) only gives me the
name of the pty of the current window or rlogin session.

I know that I can find it through wtmp, but this is not acceptable since
then there might be a lot of I/O involved which would slow down the
application too much. Also one can never be sure that a wtmp file exists.

Anyone any idea??

Thanks in advance!
-- 
Frans Meulenbroeks        (meulenbr@cst.prl.philips.nl)
	Centre for Software Technology
	( or try: ...!mcvax!philmds!prle!cst!meulenbr)

ray3rd@beaver.cs.washington.edu (Ray E Saddler III) (04/05/89)

cstw01!meulenbr@uunet.uu.net (Frans Meulenbroeks) writes:
> Is there a way to detect your login tty?  

Yes.  Run /usr/bin/tty:

ss2060 ray> tty
/dev/ttyp4
ss2060 ray>

Too easy, eh?

-- 
Ray E. Saddler III       |    __  __ __       __ |          UseNet
Boeing Aerospace         |   / / / //   //| //   | uw-beaver!ssc-vax!ray3rd
P.O. Box 3999 m.s. 3R-05 |  /-< / //-  // |// _  |         PhoneNet
Seattle, Wa.  98124  USA | /__//_//__ //  //__/  |      1+206-657-2824

[[ That tells you what tty your current window is using.  But that doesn't
necessarily tell you what tty you originally logged in on.  --wnl ]]