Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!cme!durer!rowe From: rowe@cme.nist.gov (Walter Rowe) Newsgroups: comp.unix.internals Subject: Re: Controlling ftp via a pipe: using pty's on a pipe Message-ID: Date: 6 Sep 90 19:03:57 GMT References: <1990Sep5.034248.2458@cs.umn.edu> Sender: news@cme.nist.gov Organization: National Institute of Standards and Technology Lines: 39 In-reply-to: wisdom@pico.cs.umn.edu's message of 5 Sep 90 03:42:48 GMT >>>>> On 5 Sep 90 03:42:48 GMT, wisdom@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@cme.nist.gov) if you get `expect' as he is the author. Scott> Scott Wisdom Scott> wisdom@heckle.cs.umn.edu wpr --- Walter P. Rowe ARPA: rowe@cme.nist.gov System Administrator, Robot Systems Division UUCP: uunet!cme-durer!rowe National Institute of Standards and Technology LIVE: (301) 975-3694