X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=miniexpect.pod;h=cd008fc1e85c2e25c89d81dad1d55ed5cb1a14cb;hb=238a1403413a49b1f9c90c57390854917c306df3;hp=e27a4cc196c3e41b3350670cca56e477db0d138a;hpb=ae18d42ca10e1548605014ca7fbf5a82e48c540f;p=miniexpect.git diff --git a/miniexpect.pod b/miniexpect.pod index e27a4cc..cd008fc 100644 --- a/miniexpect.pod +++ b/miniexpect.pod @@ -12,7 +12,7 @@ miniexpect - A very simple expect library for C. #include mexp_h *h; - h = mexp_spawnl ("ssh", "ssh", "host"); + h = mexp_spawnl ("ssh", "ssh", "host", NULL); switch (mexp_expect (h, regexps, ovector, ovecsize)) { ... } @@ -54,14 +54,15 @@ You can control multiple programs at the same time. =head1 SPAWNING THE SUBPROCESS -There are two calls for creating a subprocess: +There are four calls for creating a subprocess: B This creates a subprocess running the external program C (the current C<$PATH> is searched unless you give an absolute path). -C are the arguments to the program. Usually the first -argument should be the name of the program. +C are the arguments to the program. You should terminate +the list of arguments with C. Usually the first argument should +be the name of the program. The return value is a handle (see next section). @@ -70,11 +71,11 @@ the error is available in C. For example, to run an ssh subprocess you could do: - h = mexp_spawnl ("ssh", "ssh", "-l", "root", "host"); + h = mexp_spawnl ("ssh", "ssh", "-l", "root", "host", NULL); or to run a particular ssh binary: - h = mexp_spawnl ("/usr/local/bin/ssh", "ssh", "-l", "root", "host"); + h = mexp_spawnl ("/usr/local/bin/ssh", "ssh", "-l", "root", "host", NULL); An alternative to C is: @@ -83,6 +84,31 @@ B This is the same as C except that you pass the arguments in a NULL-terminated array. +There are also two versions of the above calls which take flags: + +B + +B + +The flags may contain the following values, logically ORed together: + +=over 4 + +=item B + +Do not reset signal handlers to C in the subprocess. + +=item B + +Do not close file descriptors E 3 in the subprocess. + +=item B or B + +Configure the pty in cooked mode or raw mode. Raw mode is the +default. + +=back + =head1 HANDLES After spawning a subprocess, you get back a handle which is a pointer @@ -110,7 +136,7 @@ B B -Get and set the timeout used by C [see below]. The +Get or set the timeout used by C [see below]. The resolution is milliseconds (1/1000th of a second). Set this before calling C. Passing -1 to either of the C methods means no timeout. The default setting is 60000 milliseconds (60 @@ -411,6 +437,17 @@ send a command followed by a newline you have to do something like: =back +B + +Send the interrupt character (C<^C>, Ctrl-C, C<\003>). This is like +pressing C<^C> - the subprocess (or remote process, if using C) +is gracefully killed. + +Note this only works if the pty is in cooked mode +(ie. C was passed to C or +C). In raw mode, all characters are passed through +without any special interpretation. + =head1 SOURCE Source is available from: