summaryrefslogtreecommitdiffstats
path: root/lib/utils_cmd.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/utils_cmd.h')
-rw-r--r--lib/utils_cmd.h36
1 files changed, 20 insertions, 16 deletions
diff --git a/lib/utils_cmd.h b/lib/utils_cmd.h
index 061f5d4f..04a624b8 100644
--- a/lib/utils_cmd.h
+++ b/lib/utils_cmd.h
@@ -4,36 +4,40 @@
4/* 4/*
5 * Header file for Monitoring Plugins utils_cmd.c 5 * Header file for Monitoring Plugins utils_cmd.c
6 * 6 *
7 *
8 */ 7 */
8#include "../config.h"
9#include <stddef.h>
9 10
10/** types **/ 11/** types **/
11struct output 12typedef struct {
12{
13 char *buf; /* output buffer */ 13 char *buf; /* output buffer */
14 size_t buflen; /* output buffer content length */ 14 size_t buflen; /* output buffer content length */
15 char **line; /* array of lines (points to buf) */ 15 char **line; /* array of lines (points to buf) */
16 size_t *lens; /* string lengths */
17 size_t lines; /* lines of output */ 16 size_t lines; /* lines of output */
18}; 17} output;
19
20typedef struct output output;
21 18
22/** prototypes **/ 19/** prototypes **/
23int cmd_run (const char *, output *, output *, int); 20int cmd_run(const char *, output *, output *, int);
24int cmd_run_array (char *const *, output *, output *, int); 21int cmd_run_array(char *const *, output *, output *, int);
25int cmd_file_read (char *, output *, int); 22int cmd_file_read(const char *, output *, int);
23
24typedef struct {
25 int error_code;
26 int cmd_error_code;
27 output out;
28 output err;
29} cmd_run_result;
30cmd_run_result cmd_run2(const char *cmd, int flags);
31cmd_run_result cmd_run_array2(char * const *cmd, int flags);
26 32
27/* only multi-threaded plugins need to bother with this */ 33/* only multi-threaded plugins need to bother with this */
28void cmd_init (void); 34void cmd_init(void);
29#define CMD_INIT cmd_init() 35#define CMD_INIT cmd_init()
30 36
31/* possible flags for cmd_run()'s fourth argument */ 37/* possible flags for cmd_run()'s fourth argument */
32#define CMD_NO_ARRAYS 0x01 /* don't populate arrays at all */ 38#define CMD_NO_ARRAYS 0x01 /* don't populate arrays at all */
33#define CMD_NO_ASSOC 0x02 /* output.line won't point to buf */ 39#define CMD_NO_ASSOC 0x02 /* output.line won't point to buf */
34
35
36void timeout_alarm_handler (int);
37 40
41void timeout_alarm_handler(int);
38 42
39#endif /* _UTILS_CMD_ */ 43#endif /* _UTILS_CMD_ */