2
* Expect simple tokens. Simple expect infrastructure for STONITH API
4
* Copyright (c) 2000 Alan Robertson <alanr@unix.sh>
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU Lesser General Public
8
* License as published by the Free Software Foundation; either
9
* version 2.1 of the License, or (at your option) any later version.
11
* This library is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14
* Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public
17
* License along with this library; if not, write to the Free Software
18
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25
* If we find any of the given tokens in the input stream,
26
* we return it's "toktype", so we can tell which one was
32
const char * string; /* The token to look for */
33
int toktype; /* The type to return on match */
34
int matchto; /* Modified during matches */
37
int ExpectToken(int fd
38
, struct Etoken * toklist /* List of tokens to match against */
39
/* Final token has NULL string */
40
, int to_secs /* Timeout value in seconds */
41
, char * buf /* If non-NULL, then all the text
42
* matched/skipped over by this match */
44
, int debug); /* debug level */
48
* A handy little routine. It runs the given process
49
* with it's standard output redirected into our *readfd, and
50
* its standard input redirected from our *writefd
52
* Doing this with all the pipes, etc. required for doing this
53
* is harder than it sounds :-)
56
int StartProcess(const char * cmd, int* readfd, int* writefd);