Re: Expect timeout problem. I needs help.



zelzel.zsu@xxxxxxxxx wrote:
You miss the point.
OK

actually what expect looking for is a pattern and then take an action. If it can find "Password: ", it certainly can match "Password".
YES( and this has not changed since expects inception) ,
but expect functionality needs to be used ( by you ) in a sane way.

actually you could expect just "d :" and get perfect results.

what su does is
#define MAXPASS 8
char ispass[10]
putc("\r",stderr)
putc("\n",stderr)
putc("P",stderr)
putc("a",stderr)
putc("s",stderr)
putc("s",stderr)
putc("w",stderr)
putc("o",stderr)
putc("r",stderr)
putc("d",stderr)
< your expect "Password" is successfull here and
  you start talking after some
  indeterminate delay >
putc(" ",stderr)
		< either here
putc(":",stderr)
		< or here
termctrl(noecho)
		< or even later
termctrl(flushinput)
< su starts listening here >
		< only the cases where you start as late
		< as this point you script runs sucessfully
fgets(ispasswd,MAXPASS,stdin)


read my anwser again!

The scripts do runs!!
Badly
The only problem is sometimes we get a timeout problem.
Right, now how come?
I've search in comp.lang.tcl and found that there are not a few people
who have encounter this problem.
You are right: this is a typical error make by expect beginners.
But I haven't find the solution yet.
I seem to remember that at least twice answers to the exact same
problem where given in the last 3 weeks.

uwe

.