From 290c9b1077eeb1a3acc2b2e1ffacca3571acf30d Mon Sep 17 00:00:00 2001 From: "M. Sean Finney" Date: Wed, 29 Jun 2005 04:11:29 +0000 Subject: initial versions of the runcmd framework by andreas git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@1197 f882894a-f735-0410-b71e-b25c423dba1c --- plugins/runcmd.h | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 plugins/runcmd.h (limited to 'plugins/runcmd.h') diff --git a/plugins/runcmd.h b/plugins/runcmd.h new file mode 100644 index 00000000..35ebc255 --- /dev/null +++ b/plugins/runcmd.h @@ -0,0 +1,39 @@ +/* + * $Id$ + * + * Author: Andreas Ericsson + * + * Copyright: GNU GPL v2 or any later version. + * + */ + +#ifndef NAGIOSPLUG_RUNCMD_H +#define NAGIOSPLUG_RUNCMD_H + +#include "common.h" + +/** types **/ +struct output { + char *buf; /* output buffer */ + size_t buflen; /* output buffer content length */ + char **line; /* array of lines (points to buf) */ + size_t *lens; /* string lengths */ + size_t lines; /* lines of output */ +}; + +typedef struct output output; + +/** prototypes **/ +int np_runcmd(const char *, output *, output *, int); +void popen_timeout_alarm_handler(int) + __attribute__((__noreturn__)); + +/* only multi-threaded plugins need to bother with this */ +void np_runcmd_init(void); +#define NP_RUNCMD_INIT np_runcmd_init() + +/* possible flags for np_runcmd()'s fourth argument */ +#define RUNCMD_NO_ARRAYS 0x01 /* don't populate arrays at all */ +#define RUNCMD_NO_ASSOC 0x02 /* output.line won't point to buf */ + +#endif /* NAGIOSPLUG_RUNCMD_H */ -- cgit v1.2.3-74-g34f1