ANNOUNCE: mlexpect 0.9

From: Ian T Zimmerman (
Date: Fri Jan 01 1999 - 09:21:05 MET

Date: Fri, 1 Jan 1999 00:21:05 -0800
Message-Id: <>
From: Ian T Zimmerman <>
Subject: ANNOUNCE: mlexpect 0.9

mlexpect 0.9 has been uploaded to

All comments of any kind are heartily welcome.

I quote the README file:

This is mlexpect, a feeble attempt to to the same thing in ocaml as
Don Libes' expect program does in Tcl.

Install the GNU way: configure, make, make install. This will add the
following to your system:

expect.cma ... a ocaml bytecode library
expect_lib.mli ... a ocaml interface source file for the library
expect_lib.cmi ... compiled interface file
mlexpect ... a ocaml toplevel with the expect library linked

Also, for people who still miss C macro hackery :-) I added a camlp4
gizmo in expect_p4.cmo. When you load it you can write things like

        spawn_id_0 * "exact string" => handle_exact_string
        spawn_id_1 * /"pattern"/ => handle_pattern
        spawn_id_1 * Eof => handle_eof

the handlers must be of type int -> spawn_id -> unit. The first
parameter is the ordinal of the clause in the expect construct
(starting with 0, as hinted above) and the second is the spawn_id on
which match occurred. Thus you can use the same handler in multiple


`interact' is missing. I planned to include it and have it work the
same as the interact command in real expect, but it proved so
complicated and requiring so many dirty tricks that I gave up for this
first release. Maybe later, if someone can suggest a way to do it
without breaking all the rules of clean programming (i.e. the interact
function would have to use pretty much all the internals of the Buffer
submodule, as matching must be done at every buffer position for
multiple regexps in turn).

The Pty functions assume either a plain BSD style pty allocation
scheme without any kernel or libc support (which is the way it works
on my system, Linux 2.0/GNU), or SysV style ptys (/dev/ptmx,
ptsname(), etc.; latest Linux 2.1 kernels work like this). If your
system doesn't have the SysV bells & whistles but OTOH is also
incompatible with BSD and Linux < 2.1 as far as manual allocation
(eg. if the device names are something else than [pt]ty[p-s][0-9a-f]),
you're in for some source hacking.

Ob-apology: No French version.


There are 2 (count 'em, two) ways of referring to ptys under Linux up
to 2.0. The old obsolete scheme gives both masters and slaves major
device no. 4, same as regular ttys, and starts their minor nos. at 128
and 192 respectively. The new way gives a separate major no. both to
pty masters (2) and slaves (3). IF YOUR ACTUAL DEVICE FILES USE ONE
That's what happened to me during testing. You really should convert
consistently to the new scheme ASAP. This may mean editing
/etc/devinfo and re-running /dev/MAKEDEV.

Other than that, it works; even in this immature state it statisfies
my first goal, which was to erase all traces of Tcl from my machine
:-) Enjoy.

Note the email address below is current, the one in most source files
( is outdated.

Ian T Zimmerman                        <>
I came to the conclusion that what was wrong about the guillotine
was that the condemned man had no chance at all, absolutely none.
Albert Camus, _The Outsider_

This archive was generated by hypermail 2b29 : Sun Jan 02 2000 - 11:58:17 MET