utils_cmd.h 879 B

1234567891011121314151617181920212223242526272829303132333435
  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. int cmd_file_read (char *, output *, int);
  22. /* only multi-threaded plugins need to bother with this */
  23. void cmd_init (void);
  24. #define CMD_INIT cmd_init()
  25. /* possible flags for cmd_run()'s fourth argument */
  26. #define CMD_NO_ARRAYS 0x01 /* don't populate arrays at all */
  27. #define CMD_NO_ASSOC 0x02 /* output.line won't point to buf */
  28. #endif /* _UTILS_CMD_ */