4
0

utils_cmd.h 836 B

12345678910111213141516171819202122232425262728293031323334
  1. #ifndef _UTILS_CMD_
  2. #define _UTILS_CMD_
  3. /*
  4. * Header file for nagios plugins utils_cmd.c
  5. *
  6. *
  7. */
  8. /** types **/
  9. struct output
  10. {
  11. char *buf; /* output buffer */
  12. size_t buflen; /* output buffer content length */
  13. char **line; /* array of lines (points to buf) */
  14. size_t *lens; /* string lengths */
  15. size_t lines; /* lines of output */
  16. };
  17. typedef struct output output;
  18. /** prototypes **/
  19. int cmd_run (const char *, output *, output *, int);
  20. int cmd_run_array (char *const *, output *, output *, int);
  21. /* only multi-threaded plugins need to bother with this */
  22. void cmd_init (void);
  23. #define CMD_INIT cmd_init()
  24. /* possible flags for cmd_run()'s fourth argument */
  25. #define CMD_NO_ARRAYS 0x01 /* don't populate arrays at all */
  26. #define CMD_NO_ASSOC 0x02 /* output.line won't point to buf */
  27. #endif /* _UTILS_CMD_ */