README
1This file is example/README. It contains brief descriptions of the
2examples in this directory. Also listed are scripts from the Expect
3archive at ftp.cme.nist.gov (See Expect's README for how to retrieve
4these from). You are welcome to send me additional scripts. A number
5of Expect scripts are also available in the Tcl archive, available via
6anonymous ftp at harbor.ecn.purdue.edu
7
8Note that on some systems, some of the scripts (notably kibitz and
9dislocate) require that Expect be installed. (Merely compiling the
10expect binary is not enough.)
11
12--------------------
13Expect scripts (See next section for example Tk scripts)
14--------------------
15Entries marked with "m" have their own man page.
16Entries marked with "a" live in the Expect archive (see above).
17
18 archie - mails back response after talking to archie ftp-catalog.
19 m autoexpect - generate an Expect script from watching a session
20 autopasswd - runs passwd non-interactively for superuser.
21 a bc - Uses bc to do arbitrary precision math.
22 beer.exp - 99 Bottles of Beer On The Wall, Expect-style.
23 beer.exp.out - sample output from beer.exp (but you really have to
24 run it to see the timing aspect).
25 a bonfield.exp - solve Jim Bonfield's puzzle that won the 1991 Obfuscated
26 C Code contest.
27 carpal - warn about typing for too long without a break.
28 chess.exp - has two chess games play each other.
29 m cryptdir - encrypt all files in a directory.
30 m decryptdir - decrypt all files in a directory.
31 m dislocate - allow disconnection/reconnection to background processes.
32 dvorak - dvorak keyboard.
33 a eftp - ftp client with miscellaneous frills (also see rftp below).
34 expectd.proto - telnet daemon.
35 ftp-inband - does file transfer over telnet, rlogin, etc.
36 ftp-rfc - retrieve a DoD RFC from uunet via anonymous ftp.
37 ftp-talk-radio - gets "Internet Talk Radio" files from a host.
38 gethostbyaddr - translates internet address to name (with a higher
39 success rate than nslookup). Easier to use, too.
40 getpassck - test for presence of bug in getpass.
41 irsh - run interactive commands via rsh
42 m kibitz - lets two people control a program at the same time.
43 Lots of uses. I.e., You can help another person remotely.
44 Can run an editor and log a transcript of a conversation.
45 a libro-II - connect to Libro-II, the NIST library catalog.
46 lpunlock - unhangs a printer which says it is "waiting for lock".
47 a mirror_file - mirror a file from another ftp site, copying file only
48 if changed.
49 a mirror_dir - mirror a directory from another ftp site, copying only
50 files which have changed.
51 m multixterm - drive several xterms simultaneously.
52 m mkpasswd - generates good passwords, optionally runs passwd with them.
53 a mx - return any MX records for the given host.
54 a noidle - run a shell which avoids being 'autologged out'.
55 a pager.alpha - sends a message to a (Alpha brand) pager.
56 a pager.mercury - sends a message to a (Mercury brand) pager.
57 m passmass - sets passwd on many machines simultaneously.
58 passwd.html - form to change a login passwd
59 passwd.cgi - CGI script to respond to passwd.html form
60 passwdprompt - Prompt from stdin and echo *'s.
61 a ping-and-page - Ping list of hosts. If any down, page system admin.
62 read1char - read a single character for the shell, Perl, etc.
63 reprompt - like timed-read but reprompt after given amount of time.
64 rlogin-cwd - rlogin giving you same current working directory.
65 (Compare to telnet-cwd and xrlogin.)
66 robohunt - plays the game of hunt (from Berkeley).
67 It's more of a wild player than good, but amusing to watch.
68 Fun to throw against people who don't know about it.
69 rogue.exp - finds a good game of rogue.
70 rftp - recursive ftp (assumes UNIX-style ftpd at other end).
71 a s-key-rlogin - Automate rlogin (or telnet) using s/key
72 a scripttoggle - Like UNIX script command, but allow enabling/disabling
73 of recording.
74 a slip.shar - scripts to keep your SLIP link alive.
75 su.exp - start up an 'su' and run the argument.
76 telnet-cwd - telnet giving you same current working directory.
77 telnet-in-bg - put telnet (or any program) in bg, saving all remaining
78 output to a logfile.
79 a term-rlogin - run Term over rlogin. Good for traversing PPP/SLIP or
80 firewall rlogin connections.
81 a term-start - start up Term (a sophisticated UNIX-to-UNIX serial line
82 handler).
83 a timed-choice - offer user a timed choice of responses.
84 timed-read - a timed read for the shell, Perl, etc. Compare with
85 reprompt example.
86 m timed-run - run a program for only a given amount of time.
87 a try-phone-list - automate logging in to remote system, trying numbers
88 from a list until finding one that works.
89 m unbuffer - disables output buffering that normally occurs when
90 programs are redirected.
91 virterm - example of terminal emulation and expect operations on
92 character graphics using arrays (compare to term_expect
93 (below) which uses Tk widget).
94 vrfy - verifies an email address using SMTP/VRFY to remote site.
95 a waste-collection - Contact NIST service for hazardous waste pickup.
96 weather - retrieves weather forecasts.
97 m xkibitz - similar to kibitz but uses X Window System for handling
98 communication. Also, allows users to be added dynamically.
99 xrlogin - rlogin giving you same DISPLAY. (Compare to rlogin-cwd.)
100
101To run, for example, chess.exp, type:
102
103 expect chess.exp
104
105If expect is installed and your system supports the #! magic you can
106invoke it as:
107
108 chess.exp
109
110Each of these examples necessarily depends upon other binaries in the
111system. For example, chess.exp depends upon the "usual" UNIX chess
112program being present. If any of these programs are different,
113it may cause the associated script to misbehave.
114
115Please use the ".exp" extension on scripts that might otherwise have
116names that could be confused with the real program, such as "rogue.exp".
117Scripts that have unique names do not need the extension, such as "rftp".
118
119--------------------
120Sample Expectk scripts
121--------------------
122Entries marked with "m" have their own man page.
123
124 term_expect - template for doing expect operations on character
125 graphics.
126 m tknewsbiff - pops up a window (or plays sounds, etc) when news
127 arrives in selected newsgroups.
128 tkpasswd - Tk GUI for changing passwords.
129 tkterm - Tk terminal emulator in a Tk text widget.
130 xpstat - provide an X window front end to the xpilot game.
131
132--------------------
133Sample C and C++ programs that use the Expect library
134--------------------
135
136 chesslib.c - same thing as chess.exp, but in C.
137 chesslib2.c - ditto, but uses popen and stream-style I/O.
138 chesslib++.c - ditto, but for C++.
139 m unbuffer.c - same as unbuffer example but standalone
140
141You may change the value of CC or CPLUSPLUS in the Makefile, to
142compile under gcc or other compilers. However, you may have to edit
143the lines defining where the libraries are.
144
145