cu/help

cu/help

Post by Martin Wrig » Fri, 16 Dec 1994 05:18:55



I am hoping someone can help me on this one or shed some light on it

Basically what I am trying to do is to cu to access a direct connect modem.
what I would like to do then is pass cu commands from a shell script or c prog
and then read the results from cu (what the modem is saying etc) and then
take a decision on the output based on the results back.
I think the following arrangement should work.

myprog | cu -s9600 l/dev/tty2a >named.pipe

myprog could be a script or c prog that reads from named.pipe (a named pipe),
and writes to stdout, using a delay between chars sent on stdout.

The purpose of the exersize is to dial onto a remote system , navigate a couple
of menus , and save what i get back to a file.
I know that this should be pretty easy, but the above doesn't work.
Has anyone done a similar thing on Unix (SCO at the moment).
I would be very happy if someone could shed some light on this :-)

thanks in advance.

--
==============================

PGP Key Available On Request.
==============================

 
 
 

cu/help

Post by Ruurd Beerst » Sat, 17 Dec 1994 21:51:09


: I am hoping someone can help me on this one or shed some light on it

[snip]
: myprog | cu -s9600 l/dev/tty2a >named.pipe

: myprog could be a script or c prog that reads from named.pipe (a named pipe),
: and writes to stdout, using a delay between chars sent on stdout.

[snip]

This approach has several problems:
1) writes of CU into the "named.pipe" will be buffered inside
   CU because CU sees that the pipe is "not a tty" and that buffering is
   much more efficient. Thus, the 'myprog' can have a serious problem
   because it doe not "see" output that has already been printed
   (but not flushed) by CU.
2) You can have deadlock problems when CU produces a lot of output and
   your MYPROG is busy writing a lot of commands to CU. CU will
   block because the named.pipe is "full", and MYPROG will block
   because the "normal pipe" is full (actually, in the specific
   case of CU this might not happen since CU is implemented as
   two processes, one of which is always reading the STDIN).

What you want is a PTY (pseudo terminal). CU would have this terminal
as its controlling terminal and MYPROG would be abe to control
this pseudo terminal. Several public domain packages such as
"expect" and "pty" do exactly this - create a process in a
pseudo terminal and give a program (or shell script) the capability
to send/receive data to that process. Available on an archive
site near you (check Archie).

Hope this helps.
        Ruurd.

PS.
I have got the source code of a simple PTY program that allows
something like:

   #!/bin/sh
   (
      echo bla bla
      read x
      if [ "$x" = "..."] ; then ...; else ....
   ) | pty cu -s.....

in other words, control any interactive program from a script.
Yours if you want it. Written for SVR4, so i'm not sure
if it will work for you.
--
========================================================================
Ruurd Beerstra, CMG-IT, Netherlands. | #include <stddisclaimer.h>

                                     | what is he doing on my hard disk?

 
 
 

1. PPP solaris 2.4 and cu help

Hi,
  I need some help with my PPP connection. I can't seem to get the logon
command for the "cu" command to work. The "cu -d systemname" command
dials in and then does not issue the logon commands. Here is my Systems
file:
 "systemname Any ACU 38400 5551234 command: ppp name: rallard word:
password"

Any help you will be appreciated. Thanks in advance.

Rick

2. DPMS message

3. Problems with SVR4.x cu...HELP.

4. Sony CD33A, kernel, Bogomips on IBM 486

5. Trouble with cu . . . help please?

6. SCSI Drive - Spin down if idle ?

7. Be cu'ing you (cu, packages, 2.5.1)

8. Cant login to OPENWIN when root

9. cu hangs when using Systems, though cu -l works

10. CU: questions on using cu

11. Help: what means eth0: CU Wedged error

12. Help: How can I change default baud rate used in "cu" command

13. asppp WONT dial, but CU will (HELP)