Code

Added test cases for utils_tcp
[nagiosplug.git] / plugins / runcmd.h
1 /*
2  * $Id$
3  * 
4  * Author: Andreas Ericsson <ae@op5.se>
5  *
6  * Copyright: GNU GPL v2 or any later version.
7  * 
8  */
10 #ifndef NAGIOSPLUG_RUNCMD_H
11 #define NAGIOSPLUG_RUNCMD_H
13 #include "common.h"
15 /** types **/
16 struct output {
17         char *buf;     /* output buffer */
18         size_t buflen; /* output buffer content length */
19         char **line;   /* array of lines (points to buf) */
20         size_t *lens;  /* string lengths */
21         size_t lines;  /* lines of output */
22 };
24 typedef struct output output;
26 /** prototypes **/
27 int np_runcmd(const char *, output *, output *, int);
28 void popen_timeout_alarm_handler(int)
29         __attribute__((__noreturn__));
31 /* only multi-threaded plugins need to bother with this */
32 void np_runcmd_init(void);
33 #define NP_RUNCMD_INIT np_runcmd_init()
35 /* possible flags for np_runcmd()'s fourth argument */
36 #define RUNCMD_NO_ARRAYS 0x01 /* don't populate arrays at all */
37 #define RUNCMD_NO_ASSOC 0x02  /* output.line won't point to buf */
39 #endif /* NAGIOSPLUG_RUNCMD_H */