mirror of
https://github.com/monitoring-plugins/monitoring-plugins.git
synced 2026-07-07 08:01:36 -04:00
Some checks are pending
CodeQL / Analyze (push) Waiting to run
Spellcheck / codespell (push) Waiting to run
Tests / Running unit and integrationt tests (push) Waiting to run
Tests / Running rpm build test on almalinux:9 (push) Waiting to run
Tests / Running rpm build test on fedora:latest (push) Waiting to run
Tests / Running rpm build test on rockylinux:8 (push) Waiting to run
Co-authored-by: Lorenz Kästle <lorenz.kaestle@netways.de>
43 lines
1.1 KiB
C
43 lines
1.1 KiB
C
#ifndef _UTILS_CMD_
|
|
#define _UTILS_CMD_
|
|
|
|
/*
|
|
* Header file for Monitoring Plugins utils_cmd.c
|
|
*
|
|
*/
|
|
#include "../config.h"
|
|
#include <stddef.h>
|
|
|
|
/** types **/
|
|
typedef struct {
|
|
char *buf; /* output buffer */
|
|
size_t buflen; /* output buffer content length */
|
|
char **line; /* array of lines (points to buf) */
|
|
size_t lines; /* lines of output */
|
|
} output;
|
|
|
|
/** prototypes **/
|
|
int cmd_run(const char *, output *, output *, int);
|
|
int cmd_run_array(char *const *, output *, output *, int);
|
|
int cmd_file_read(const char *, output *, int);
|
|
|
|
typedef struct {
|
|
int error_code;
|
|
int cmd_error_code;
|
|
output out;
|
|
output err;
|
|
} cmd_run_result;
|
|
cmd_run_result cmd_run2(const char *cmd, int flags);
|
|
cmd_run_result cmd_run_array2(char *const *cmd, int flags);
|
|
|
|
/* only multi-threaded plugins need to bother with this */
|
|
void cmd_init(void);
|
|
#define CMD_INIT cmd_init()
|
|
|
|
/* possible flags for cmd_run()'s fourth argument */
|
|
#define CMD_NO_ARRAYS 0x01 /* don't populate arrays at all */
|
|
#define CMD_NO_ASSOC 0x02 /* output.line won't point to buf */
|
|
|
|
void timeout_alarm_handler(int);
|
|
|
|
#endif /* _UTILS_CMD_ */
|