summaryrefslogtreecommitdiff
path: root/example/archie
diff options
context:
space:
mode:
authorAnas Nashif <anas.nashif@intel.com>2012-11-04 17:21:04 -0800
committerAnas Nashif <anas.nashif@intel.com>2012-11-04 17:21:04 -0800
commite0b431a48cc3ac5d3ec32f06eddd9708ad655fa2 (patch)
treece4c73521220fbb751c2be6a42e85ff6a6cbff97 /example/archie
downloadexpect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.tar.gz
expect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.tar.bz2
expect-e0b431a48cc3ac5d3ec32f06eddd9708ad655fa2.zip
Imported Upstream version 5.45upstream/5.45
Diffstat (limited to 'example/archie')
-rwxr-xr-xexample/archie41
1 files changed, 41 insertions, 0 deletions
diff --git a/example/archie b/example/archie
new file mode 100755
index 0000000..0d5f43f
--- /dev/null
+++ b/example/archie
@@ -0,0 +1,41 @@
+#!/bin/sh
+# -*- tcl -*-
+# The next line is executed by /bin/sh, but not tcl \
+exec tclsh "$0" ${1+"$@"}
+
+package require Expect
+
+# archie
+
+# Log in to the archie ftp-catalog at McGill University, and mail back results
+# Brian P. Fitzgerald
+# Department of Mechanical Engineering
+# Rensselaer Polytechnic Institute
+
+set CINTR \003 ;# ^C
+set CSUSP \032 ;# ^Z
+
+set timeout -1
+spawn telnet quiche.cs.mcgill.ca
+
+expect_after eof exit ;# archie logs us out if too many people are logged in
+
+expect {
+ login: {send archie\r}
+ "unknown" {exit 1}
+ "unreachable" {exit 1}
+}
+
+expect "archie>" {send "set pager\r"}
+expect "archie>" {send "set maxhits 20\r"}
+expect "archie>" {send "set term vt100\r"}
+expect "archie>" {send "set sortby time\r"}
+expect "archie>" {
+ send "set mailto [exec whoami]@[exec hostname].[exec domainname]\r"
+}
+
+send_user "type ^C to exit, ^Z to suspend\n"
+interact {
+ -reset $CSUSP {exec kill -STOP [pid]}
+ $CINTR {exit 0}
+}