[comp.unix.questions] Telling whether the user is at the console

pjs@aristotle.JPL.NASA.gov (Peter Scott) (10/02/90)

What's the easiest way to tell from (1) a shell script; (2) a C
program, whether the user process that called either of them was
logged in at the console?  I've looked at /etc/utmp, but it seems
that there should be an easier way.

-- 
This is news.  This is your       |    Peter Scott, NASA/JPL/Caltech
brain on news.  Any questions?    |    (pjs@aristotle.jpl.nasa.gov)

cpcahil@virtech.uucp (Conor P. Cahill) (10/02/90)

In article <1990Oct1.204707.21038@elroy.jpl.nasa.gov> pjs@aristotle.jpl.nasa.gov writes:
>What's the easiest way to tell from (1) a shell script; (2) a C
>program, whether the user process that called either of them was
>logged in at the console?  I've looked at /etc/utmp, but it seems

1. tty(1)
2. ttyname(3)

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170