🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.sys.sun
Article #12239

Finding your tty

#12239
From: dave driver
Date: Tue, 25 Apr 1989 21:56
26 lines
1759 bytes
cstw01!meulenbr@uunet.uu.net (Frans Meulenbroeks) writes:
> Is there a way to detect your login tty?  

/usr/bin/tty will show the name of the tty for your current shell (RTFM
would have been good advice here), but if you specifically want to know
the tty on which you logged in, try setting an environment variable from
your .login file, i.e.

setenv LOGTTY `tty`

N.B. this will not work in a remote shell since the environment will not
be passed in this case due to a documented bug.

 Dave Driver (D^2)		dmd@cel.co.uk
 Crosfield Electronics		mcvax!ukc!uk.co.cel!dmd
 +44 442 230000 ext 3355

[[ RTFOP might be appropriate for this message (OP == "original posting"):
"ttyname(3) only gives me the name of the pty of the current window or
rlogin session."  He doesn't want the name of the tty associated with the
current window (which is what /usr/bin/tty gives you).  He wants the name
of the tty you originally (as in before starting suntools) logged in on.
To answer that question:  other than looking in utmp, the only way I can
think of doing it is walking back through the chain of parent process proc
structures to find the one for the login process and extract the
controlling terminal id from there.  Not a pleasant procedure.  --wnl ]]
Technical Details
Message-ID: <8904061109.AA02168@sun103.cel.uucp>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request
From: mcvax!cel!dmd@uunet.uu.net (dave driver)
Newsgroups: comp.sys.sun
Subject: Finding your tty
Keywords: SunOS
Message-ID: <8904061109.AA02168@sun103.cel.uucp>
Date: 25 Apr 89 21:56:58 GMT
Sender: usenet@rice.edu
Organization: Sun-Spots
Lines: 26
Approved: Sun-Spots@rice.edu
Original-Date: Thu, 6 Apr 89 12:09:55 BST
X-Sun-Spots-Digest: Volume 7, Issue 248, message 7 of 13