I'm trying to write a program using Guile's expect module to
automatically log into a telnet server, perform some action, and log
out.

This is the start of my program...

#! /usr/bin/guile -s
!#

(use-modules (ice-9 expect))
(use-modules (ice-9 popen))

(define ie-io (open-pipe* OPEN_BOTH
                          "/usr/bin/telnet"
                          "ienabler.canterbury.ac.nz" "259"))

Then I have a sexp for debugging, which shows that `expect' is getting
one character at a time from the telnet subprocess, since it only
prints out "Tmatch", instead of "Trying [IP address]..."

(let ((expect-port ie-io))
  (expect
   ((lambda (s eof?) (display s))
    (display "match"))))

I tried (setvbuf ie-io _IOLBF), but that produces the following error.

Backtrace:
In current input:
  18: 0* [setvbuf {#<input-output: soft 807be60>} 1]

<unnamed port>:18:1: In procedure setvbuf in expression (setvbuf ie-io _IOLBF):
<unnamed port>:18:1: Wrong type argument in position 1 (expecting open file
port): #<input-output: soft 807be60>
ABORT: (wrong-type-arg)

Can anyone offer any advice on how to get expect to see entire lines?

--Aidan

P.S. ienabler.canterbury.ac.nz is on the inside only of my
university's network, but this is what the output looks like up to the
first prompt...

Trying [IP address]...
Connected to ienabler.canterbury.ac.nz.
Escape character is '^]'.
Check Point FireWall-1 Client Authentication Server running on cpgate1
User: 



Reply via email to