Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Q] expect, ftp and '@'

0 views
Skip to first unread message

Benjamin Thomas

unread,
May 18, 1994, 5:20:25 PM5/18/94
to
Hi everybody !

I am attempting to use expect to perform anonymous ftp gets without my having to type all the stuff --- I mean, waaaiiiting for the prompt, entering a-n-o-n-y-m-o-u-s with my fat fingers, and the rest.

But I have a probleme: as I set the password to be my e-mail address:

set password "b...@hplb.hpl.hp.com"

the ftp servers seem not to receive neither my login name nor the at-sign. Some of them do not care, some others say "ok, but don't do that again", and the last ones throw me off.

Hence, what's wrong, doc ?


* Benjamin THOMAS
* < b...@hplb.hpl.hp.com >
* French student in HP Labs, Bristol

Don Libes

unread,
May 19, 1994, 11:05:03 AM5/19/94
to
In article <Cq0oM...@hplb.hpl.hp.com> b...@nadine.hpl.hp.com (Benjamin Thomas) writes:
> I am attempting to use expect to perform anonymous ftp gets without
>my having to type all the stuff --- I mean, waaaiiiting for the
>prompt, entering a-n-o-n-y-m-o-u-s with my fat fingers, and the rest.
>
> But I have a probleme: as I set the password to be my e-mail address:
> set password "b...@hplb.hpl.hp.com"

> the ftp servers seem not to receive neither my login name nor the
>at-sign. Some of them do not care, some others say "ok, but don't do
>that again", and the last ones throw me off.

spawn initializes the terminal using your current parameters and then
forces them to be "sane". Unfortunately, on your system "sane" says
to interprete the "@" as the line-kill character.

The most sensible thing to do is change "sane" in your Makefile to
something that makes sense. (Since you work at HP, you might also
suggest that they modernize stty!)

Other alternatives are: quote the @, or use the -nottyinit flag, or
set the stty_init variable.

Don

Owen Rees

unread,
May 25, 1994, 5:45:03 AM5/25/94
to
b...@nadine.hpl.hp.com (Benjamin Thomas) writes:
> Hi everybody !
>
> I am attempting to use expect to perform anonymous ftp [...]

Here are two procs you may find useful - I only wrote them within the last few
days so they have not been very extensively tested yet, nor made robust for
all the things that can go wrong (e.g. there is no checking of the responses).

The first opens the ftp connection, replying to the prompts for name and
password; it is supposed to do the right thing if you have specified a user
and password for that host in your .netrc file. Note also that it returns the
spawn id as its result - the global variable spawn_id is NOT set.

The second proc closes the spawn and waits for the process so that you do not
accumulate defunct processes. The 'close' is in a 'catch' so that it can be
called on spawn ids that have been closed form the other end as well as those
that are still open.

proc FTPinit { } {
global host user pass
spawn ftp $host
expect {
"Name*:" { exp_send "$user\r" ; exp_continue }
"Password:" { exp_send "$pass\r" ; exp_continue }
"ftp>" { }
default { error "FTP open failed" }
}
exp_send "binary\r"
expect "ftp>"
return $spawn_id
}

proc SIDfinish {sid} {
catch {close -i $sid}
catch {wait -i $sid}
}

# Owen Rees <rt...@ansa.co.uk>

0 new messages