Can cu do call-backs to terminals?

Pete French pcf at galadriel.bt.co.uk
Wed Aug 30 01:01:10 AEST 1989


>From article <0532.AA0532 at julie>, by mcr at julie.UUCP (Michael Richardson):
> Pete French writes:
>>Forget cu - it does far more than you need. I had to do this once and the
>>solution I came up with was to write a C program that called out on a hayes
>>modem line and when it got a 'CONNECT' message it forked a getty. For this to
>>work the process must attach stdin, stdout and stderr to the outgoing terminal
> 
>   I wanted to `exec getty' from the shell script, which did work fine ---
> except that login wants the password from stderr. Okay, bypass this
> problem for the moment and enter it in from my test terminal, and
> then it dies --- the `/etc/utmp' entry points to the wrong pid.

Oh god, this brings back bad memories ... yes, you do have to play with the
/etc/utmp entry. A large chunk of my program was designed to set it up the
way it would be before a getty was placed onto it in the normal manner.
The login problem is sloved by making the getty head of the process group
with all the stin,stdout,stderr pointing to the terminal.

> I'll probably try again, and bit the bullet and do it in C. (Very difficult
> to debug programs when their stdin/stdout is not your terminal, and
> you need another machine, two phones lines, --- if there were two
> phone lines available, one would be outbound and the problem solved.)

I think that it can only be done in C - due to the need for setting process
groups and playing with utmp. The comment about debugging is valid - the
way that I did it was to connect a hardcopy terminal in place of the modem
and then type the responses that the hayes would produce in on the keyboard.
This also meant thatr I could test the logging in when the getty had been
spawned.

The interesting thing was that it all worked fine when connected to the terminal
but when connected to the modem it did not work at all. I didnt have the time
to finish playing with this. I will try and re-aquire the src this evening so
if anyone wants to play with it they can. Mail me if your interested.

-Pete.
-- 
       -Pete French.               |
  British Telecom Research Labs.   | "The carefree days are distant now,
 Martlesham Heath, East Anglia.    |  I wear my memories like a shroud..."
All my own thoughts (of course)    |                               -SIOUXSIE



More information about the Comp.unix.wizards mailing list