diff --git a/demo/dualftp.py b/demo/dualftp.py index e2cff3ecfbbfffa74643a1d7f394405ba7a40680..e7ff0f0e539056b3ea11f289864638ed25b0c684 100644 --- a/demo/dualftp.py +++ b/demo/dualftp.py @@ -10,12 +10,13 @@ import sys import time import pcl_expect +import pcl_expect.spawn -pcl_expect.stty_init = "-onlcr -ocrnl -echo" +pcl_expect.spawn.stty_init = "-onlcr -ocrnl -echo" time0 = time.time() -funet = pcl_expect.spawn("ftp ftp.funet.fi") -sunet = pcl_expect.spawn("ftp ftp.sunet.se") +funet = pcl_expect.spawn.spawn("ftp ftp.funet.fi") +sunet = pcl_expect.spawn.spawn("ftp ftp.sunet.se") def name_cb(ftp): ftp.send("anonymous\n") @@ -56,7 +57,7 @@ pcl_expect.expect_after([(pcl_expect.RE, funet, "Name.*:", name_cb), (pcl_expect.RE, funet, "(?s).*ftp> ", prompt_cb), (pcl_expect.RE, sunet, "(?s).*ftp> ", prompt_cb)]) -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.timeout(): sys.stdout.write(".") @@ -69,7 +70,7 @@ funet.send("bye\n") pcl_expect.expect_after([]) -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.eof(sunet): print "SUNET final output:", sunet.match @@ -80,7 +81,7 @@ while x.loop(): x.cont() continue -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.eof(funet): print "FUNET final output:", funet.match diff --git a/demo/ftp.py b/demo/ftp.py index a7748dbdd461b96da2c022efb6b6d8b7272f31ef..39b1f2f3892cc2fa17b81657f97852c2afb81a6c 100644 --- a/demo/ftp.py +++ b/demo/ftp.py @@ -1,12 +1,13 @@ # The mandatory ftp example... +import pcl_expect.spawn import pcl_expect -pcl_expect.stty_init = "-onlcr -ocrnl" +pcl_expect.spawn.stty_init = "-onlcr -ocrnl" -ftp = pcl_expect.spawn("ftp ftp.funet.fi") +ftp = pcl_expect.spawn.spawn("ftp ftp.funet.fi") -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.re(ftp, "Name.*:"): ftp.send("anonymous\n") @@ -21,21 +22,21 @@ while x.loop(): ftp.send("cd pub\n") -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.re(ftp, "(?s).*ftp> "): pass ftp.send("passive\n") -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.re(ftp, "(?s).*ftp> "): pass ftp.send("dir\n") -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.re(ftp, "(?s).*ftp> "): print ftp.match.group() diff --git a/demo/ftp.pyex b/demo/ftp.pyex index baa2e7aee965a7286920545d7731653bb5ac0711..ca10ff43a8e87f75631eefe51604f16ae40741fa 100644 --- a/demo/ftp.pyex +++ b/demo/ftp.pyex @@ -1,10 +1,11 @@ # The mandatory ftp example... import pcl_expect +import pcl_expect.spawn -pcl_expect.stty_init = "-onlcr -ocrnl" +pcl_expect.spawn.stty_init = "-onlcr -ocrnl" -ftp = pcl_expect.spawn("ftp ftp.funet.fi") +ftp = pcl_expect.spawn.spawn("ftp ftp.funet.fi") expect: re(ftp, "Name.*:"): diff --git a/demo/ftptrad.py b/demo/ftptrad.py index 84028cfdacdd6ff80c0a60f2d40a79bd497fced5..b6f5ae661bcd150ee8eb5db5edbe389f858c2bfe 100644 --- a/demo/ftptrad.py +++ b/demo/ftptrad.py @@ -1,10 +1,11 @@ # The mandatory ftp example, in traditional style. import pcl_expect +import pcl_expect.spawn -pcl_expect.stty_init = "-onlcr -ocrnl" +pcl_expect.spawn.stty_init = "-onlcr -ocrnl" -ftp = pcl_expect.spawn("ftp ftp.funet.fi") +ftp = pcl_expect.spawn.spawn("ftp ftp.funet.fi") def send_anon(exp): exp.send("anonymous\n") diff --git a/demo/telnet.py b/demo/telnet.py index e1e9037a199028adfaaf7107e10c2844667200e0..6e219e82d73144e7f099db0d7f55925684cbbb46 100644 --- a/demo/telnet.py +++ b/demo/telnet.py @@ -6,6 +6,7 @@ import os import sys import pcl_expect +import pcl_expect.telnet host = sys.argv[1] user = sys.argv[2] @@ -23,19 +24,19 @@ print if len(password) > 0 and password[-1] == "\n": password = password[:-1] -t = pcl_expect.telnet(host, "23") +t = pcl_expect.telnet.telnet(host, "23") -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.re(t, "ogin:"): t.send(user + "\n") -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.re(t, "assword:"): t.send(password + "\n") -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.re(t, ">|\\$|#"): t.send("uname -a\n") @@ -44,13 +45,13 @@ while x.loop(): t.close() sys.exit(1) -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.re(t, "(.*)\r?\n.*(>|\\$|#)"): print "SYSTEM ID:", t.match.group(1) t.send("exit\n") -x = pcl_expect.impl() +x = pcl_expect.controller() while x.loop(): if x.eof(t): t.close()