Controlling ftp via a pipe: using pty's on a pipe
Walter Rowe
rowe at cme.nist.gov
Fri Sep 7 05:03:57 AEST 1990
>>>>> On 5 Sep 90 03:42:48 GMT, wisdom at pico.cs.umn.edu (Scott Wisdom) said:
Scott> I am writting an application which needs to interactively
Scott> control an ftp session.
I suggest you get a program developed here at NIST called `expect',
which allows you write shell-script-like code to interact with
programs that are normally user-interactive. You `expect' some given
set of regular expressions, and give a set of actions to perform
depending on which of those regular expressions `expect' sees from the
program (ie. the "*ftp>" prompt, or the "*login: " prompt).
This program can be retrieved via anon ftp from durer.cme.nist.gov
(129.6.32.4) under ~ftp/pub/expect.shar.Z. You may also have to get
the file tcl.tar.Z as well, since `expect' is uses the tcl (Tool
Command Language) library. There is also a paper written about expect
called `expect.ps.Z'. I suggest reading that, too.
Believe me, this will be much simple than writing all the C code
yourself, and expect can interact with *any* interactive program.
It has a relatively extensive man page, and the TCL man page is very
useful as well. It comes with several example scripts, including one
for ftp and one that makes two chess(6) processes play against each
other.
Scott> Many thanks in advance to those who can help a frustrated
Scott> programmer who's running out of hair to pull.
I would encourage your sending thanks to Don Libes (libes at cme.nist.gov)
if you get `expect' as he is the author.
Scott> Scott Wisdom
Scott> wisdom at heckle.cs.umn.edu
wpr
---
Walter P. Rowe ARPA: rowe at cme.nist.gov
System Administrator, Robot Systems Division UUCP: uunet!cme-durer!rowe
National Institute of Standards and Technology LIVE: (301) 975-3694
More information about the Comp.unix.internals
mailing list