How to read from a tty (that you own)?

How to read from a tty (that you own)?

Post by Scott Sorre » Fri, 19 May 1995 04:00:00



I am considering writing a program that will watch the tty that it is run from
for a talk request and if one is found will send a response to the person.

My problem at this point is I don't know how to read from the tty for the talk
request?  Is there an easy way to do this?  

I have tried just opening the tty as a file and reading from it but that only
gets stuff typed at the keyboard.  Things like the talk request seem to go
directly to the screen.  

I would rewrite the talk daemon but then I would have to convince the sysadmin
of the system I use to use my talk daemon.  So I would rather end up with a
program that could be run on any unix system.

Also, is there already a program out there that will do this?

Thanks in advance for any help.

--
Scott Sorrell

 
 
 

How to read from a tty (that you own)?

Post by Lebeau Mar » Mon, 22 May 1995 04:00:00



>I am considering writing a program that will watch the tty that it is run from
>for a talk request and if one is found will send a response to the person.

>My problem at this point is I don't know how to read from the tty for the talk
>request?  Is there an easy way to do this?  

>I have tried just opening the tty as a file and reading from it but that only
>gets stuff typed at the keyboard.  Things like the talk request seem to go
>directly to the screen.  

Sorry, scott, but the talk daemon does not check for data on the tty: the
talk requests are 'posted' to a TCP/IP port and handled by the talkd
program afterward. As the talkd program has suid 'root', it may wrtie to
anyone's tty.
If you want to know more about this, check the linux networking sources
on sunsite.unc.edu.

 
 
 

How to read from a tty (that you own)?

Post by Scott Sorre » Tue, 23 May 1995 04:00:00



>Sorry, scott, but the talk daemon does not check for data on the tty: the
>talk requests are 'posted' to a TCP/IP port and handled by the talkd
>program afterward. As the talkd program has suid 'root', it may wrtie to
>anyone's tty.
>If you want to know more about this, check the linux networking sources
>on sunsite.unc.edu.

This is not what I was asking about.  I know how the talkd works.

What I want to know is if there is any way to read the info that the talkd
writes to the user's tty.

--
Scott Sorrell

 
 
 

How to read from a tty (that you own)?

Post by Kurt Fran » Thu, 25 May 1995 04:00:00


|> I am considering writing a program that will watch the tty that it is run from
|> for a talk request and if one is found will send a response to the person.
|>
|> My problem at this point is I don't know how to read from the tty for the talk
|> request?  Is there an easy way to do this?  
|>
|> I have tried just opening the tty as a file and reading from it but that only
|> gets stuff typed at the keyboard.  Things like the talk request seem to go
|> directly to the screen.  
|>
|> I would rewrite the talk daemon but then I would have to convince the sysadmin
|> of the system I use to use my talk daemon.  So I would rather end up with a
|> program that could be run on any unix system.
|>
|> Also, is there already a program out there that will do this?
|>
|> Thanks in advance for any help.
|>
|> --
|> Scott Sorrell

when the talkd writes to a tty its output occures on the output queue
of the terminal. when you do a read you will get characters from the
input queue. you cannot get characters from the output queue.

what you need is a pseudo terminal driver with its slave terminal
registered in /etc/utmp.
on the pseudo terminal master device then you can read the data written to
the slave device and can do with it what ever you want.

kf

--

 
 
 

How to read from a tty (that you own)?

Post by Russell Edwar » Sat, 27 May 1995 04:00:00



>when the talkd writes to a tty its output occures on the output queue
>of the terminal. when you do a read you will get characters from the
>input queue. you cannot get characters from the output queue.
>what you need is a pseudo terminal driver with its slave terminal
>registered in /etc/utmp.
>on the pseudo terminal master device then you can read the data written to
>the slave device and can do with it what ever you want.

 Just wondering, is that how ttysnoop works? or is there some other way
than this?

Russell
--

 Student of Computer Science and Electrical and Computer Systems Engineering
 -\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-
           Six-Oh-Six-Oh-Eight-Four-Two and I'm waiting for you.

 
 
 

1. Reading TTY/Pseudo TTY Programming

I am trying to read all characters passing through my tty in the
background.  Sorta like 'script' but I need the input not just echoed
output.  

Could someone please explain the concept of pseudo tty's and the
master/slave/dup() relationship?  And why that is required in order to have
the background proccess get stdin as well as the forground proccess?

Thanks.

2. xfs comsume all cpu power.

3. Getting your own tty

4. Question

5. monitoring a tty on my own acct?

6. Help! I cannot get XFree86 working...

7. user owns login tty

8. PATCH: fix non SMP acpi build

9. SPARCworks C compiler can't read it's own libraries!

10. kspread can't read its own output?!

11. Own Your Own Power Company!

12. Good way to read my own resource file?

13. IF you own a kingmax with no linux support READ