From cb582adcf22da68cc65a78cb52bf32808f75b591 Mon Sep 17 00:00:00 2001
From: Per Cederqvist <ceder@lysator.liu.se>
Date: Mon, 6 Oct 2003 20:29:08 +0000
Subject: [PATCH] New file.  This should be automatically generated from
 ftp.pyex, but for now it is written manually.

---
 demo/ftp.py | 43 +++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 43 insertions(+)
 create mode 100644 demo/ftp.py

diff --git a/demo/ftp.py b/demo/ftp.py
new file mode 100644
index 0000000..a7748db
--- /dev/null
+++ b/demo/ftp.py
@@ -0,0 +1,43 @@
+# The mandatory ftp example...
+
+import pcl_expect
+
+pcl_expect.stty_init = "-onlcr -ocrnl"
+
+ftp = pcl_expect.spawn("ftp ftp.funet.fi")
+
+x = pcl_expect.impl()
+while x.loop():
+    if x.re(ftp, "Name.*:"):
+        ftp.send("anonymous\n")
+        x.cont()
+        continue
+    elif x.re(ftp, "Password:"):
+        ftp.send("ceder@lysator.liu.se\n")
+        x.cont()
+        continue
+    elif x.re(ftp, "ftp> "):
+        pass
+
+ftp.send("cd pub\n")
+
+x = pcl_expect.impl()
+while x.loop():
+    if x.re(ftp, "(?s).*ftp> "):
+        pass
+
+ftp.send("passive\n")
+
+x = pcl_expect.impl()
+while x.loop():
+    if x.re(ftp, "(?s).*ftp> "):
+        pass
+
+ftp.send("dir\n")
+
+x = pcl_expect.impl()
+while x.loop():
+    if x.re(ftp, "(?s).*ftp> "):
+        print ftp.match.group()
+
+ftp.close()
-- 
GitLab