4
0

runcmd.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /****************************************************************************
  2. *
  3. * License: GPL
  4. * Copyright (c) 2005 Nagios Plugins Development Team
  5. * Author: Andreas Ericsson <ae@op5.se>
  6. *
  7. *
  8. * This program is free software: you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation, either version 3 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful,
  14. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU General Public License
  19. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  20. *
  21. * $Id$
  22. *
  23. *****************************************************************************/
  24. #ifndef NAGIOSPLUG_RUNCMD_H
  25. #define NAGIOSPLUG_RUNCMD_H
  26. #include "common.h"
  27. /** types **/
  28. struct output {
  29. char *buf; /* output buffer */
  30. size_t buflen; /* output buffer content length */
  31. char **line; /* array of lines (points to buf) */
  32. size_t *lens; /* string lengths */
  33. size_t lines; /* lines of output */
  34. };
  35. typedef struct output output;
  36. /** prototypes **/
  37. int np_runcmd(const char *, output *, output *, int);
  38. void popen_timeout_alarm_handler(int)
  39. __attribute__((__noreturn__));
  40. /* only multi-threaded plugins need to bother with this */
  41. void np_runcmd_init(void);
  42. #define NP_RUNCMD_INIT np_runcmd_init()
  43. /* possible flags for np_runcmd()'s fourth argument */
  44. #define RUNCMD_NO_ARRAYS 0x01 /* don't populate arrays at all */
  45. #define RUNCMD_NO_ASSOC 0x02 /* output.line won't point to buf */
  46. #endif /* NAGIOSPLUG_RUNCMD_H */