🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.unix.programmer
Article #1093

How to determine tty device

#1093
From: david.r.connet
Date: Thu, 25 Oct 1990 13:57
20 lines
1328 bytes
Does anyone know how I can figure out the name of the tty device
I am on?  (Please don't say ttyname(3), I know that.)  The problem
is after opening communication directly to /dev/tty, I need to
figure out which device I'm actually on.  (In case it matters, I'm
on a SVR3.2.2 system.)  ttyname() just reports "/dev/tty".

Background: This is running under layers, and I need to identify
if this is the window that the system is going to use to write
messages to.  (I can't run in that window.)  I'm currently obtaining
the name of the device, stuffing it in a utmp structure and using
the getutline() call to see if there is a utmp entry.  I don't want
to assume that a user has not redirected stdin/stdout (strange things
happen when they do that, so I don't want to allow them that).

Please email me at "dcon@iwtng.att.com" as I don't regularly read
this group.

Thanks in advance.
Dave Connet
Technical Details
Message-ID: <1990Oct25.135740.15742@cbnewsc.att.com>
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsc!dcon

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!attcan!uunet!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!cbnewsc!dcon
From: dcon@cbnewsc.att.com (david.r.connet)
Newsgroups: comp.unix.programmer
Subject: How to determine tty device
Keywords: /dev/tty ttyname getutline
Message-ID: <1990Oct25.135740.15742@cbnewsc.att.com>
Date: 25 Oct 90 13:57:40 GMT
Distribution: na
Organization: AT&T Bell Laboratories
Lines: 20