diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:40:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 06:40:13 +0000 |
commit | e9be59e1502a41bab9891d96d753102a7dafef0b (patch) | |
tree | c3b2da87c414881f4b53d0964f407c83492d813e /include/stonith/expect.h | |
parent | Initial commit. (diff) | |
download | cluster-glue-upstream.tar.xz cluster-glue-upstream.zip |
Adding upstream version 1.0.12.upstream/1.0.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/stonith/expect.h')
-rw-r--r-- | include/stonith/expect.h | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/include/stonith/expect.h b/include/stonith/expect.h new file mode 100644 index 0000000..6084ef1 --- /dev/null +++ b/include/stonith/expect.h @@ -0,0 +1,61 @@ +/* + * Expect simple tokens. Simple expect infrastructure for STONITH API + * + * Copyright (c) 2000 Alan Robertson <alanr@unix.sh> + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + */ + +#ifndef __EXPECT_H +# define __EXPECT_H +/* + * If we find any of the given tokens in the input stream, + * we return it's "toktype", so we can tell which one was + * found. + * + */ + +struct Etoken { + const char * string; /* The token to look for */ + int toktype; /* The type to return on match */ + int matchto; /* Modified during matches */ +}; + +int ExpectToken(int fd +, struct Etoken * toklist /* List of tokens to match against */ + /* Final token has NULL string */ +, int to_secs /* Timeout value in seconds */ +, char * buf /* If non-NULL, then all the text + * matched/skipped over by this match */ +, int maxline, +, int debug); /* debug level */ + + +/* + * A handy little routine. It runs the given process + * with it's standard output redirected into our *readfd, and + * its standard input redirected from our *writefd + * + * Doing this with all the pipes, etc. required for doing this + * is harder than it sounds :-) + */ + +int StartProcess(const char * cmd, int* readfd, int* writefd); + +#ifndef EOS +# define EOS '\0' +#endif +#endif /*__EXPECT_H*/ |