File: runcmd.h

package info (click to toggle)
nagios-plugins 1.4.5-1etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 6,520 kB
  • ctags: 3,564
  • sloc: ansic: 34,372; perl: 12,573; sh: 10,669; python: 444; makefile: 440; awk: 45
file content (39 lines) | stat: -rw-r--r-- 1,013 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
 * $Id: runcmd.h,v 1.2 2005/10/24 11:10:29 seanius Exp $
 * 
 * Author: Andreas Ericsson <ae@op5.se>
 *
 * 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 */