runcmd.h 964 B

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