parse_ini.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #ifndef _PARSE_INI_H_
  2. #define _PARSE_INI_H_
  3. /*
  4. * parse_ini.h: routines for loading nagios-plugin defaults from ini
  5. * configuration files.
  6. */
  7. /* np_arg_list is a linked list of arguments passed between the ini
  8. * parser and the argument parser to construct the final array */
  9. typedef struct np_arg_el {
  10. char *arg;
  11. struct np_arg_el *next;
  12. } np_arg_list;
  13. /* NP_DEFAULT_INI_PATH: compile-time default location for ini file
  14. #ifndef NP_DEFAULT_INI_PATH
  15. # define NP_DEFAULT_INI_PATH "/etc/nagios-plugins.ini"
  16. #endif NP_DEFAULT_INI_PATH */
  17. /* Filenames (see below) */
  18. #ifndef NP_DEFAULT_INI_FILENAME1
  19. # define NP_DEFAULT_INI_FILENAME1 "plugins.ini"
  20. #endif /* NP_DEFAULT_INI_FILENAME1 */
  21. #ifndef NP_DEFAULT_INI_FILENAME2
  22. # define NP_DEFAULT_INI_FILENAME2 "nagios-plugins.ini"
  23. #endif /* NP_DEFAULT_INI_FILENAME2 */
  24. /* Config paths ending in nagios (search for NP_DEFAULT_INI_FILENAME1) */
  25. #ifndef NP_DEFAULT_INI_NAGIOS_PATH1
  26. # define NP_DEFAULT_INI_NAGIOS_PATH1 "/etc/nagios"
  27. #endif /* NP_DEFAULT_INI_NAGIOS_PATH1 */
  28. #ifndef NP_DEFAULT_INI_NAGIOS_PATH2
  29. # define NP_DEFAULT_INI_NAGIOS_PATH2 "/usr/local/nagios/etc"
  30. #endif /* NP_DEFAULT_INI_NAGIOS_PATH2 */
  31. #ifndef NP_DEFAULT_INI_NAGIOS_PATH3
  32. # define NP_DEFAULT_INI_NAGIOS_PATH3 "/usr/local/etc/nagios"
  33. #endif /* NP_DEFAULT_INI_NAGIOS_PATH3 */
  34. #ifndef NP_DEFAULT_INI_NAGIOS_PATH4
  35. # define NP_DEFAULT_INI_NAGIOS_PATH4 "/etc/opt/nagios"
  36. #endif /* NP_DEFAULT_INI_NAGIOS_PATH4 */
  37. /* Config paths not ending in nagios (search for NP_DEFAULT_INI_FILENAME2) */
  38. #ifndef NP_DEFAULT_INI_PATH1
  39. # define NP_DEFAULT_INI_PATH1 "/etc"
  40. #endif /* NP_DEFAULT_INI_PATH1 */
  41. #ifndef NP_DEFAULT_INI_PATH2
  42. # define NP_DEFAULT_INI_PATH2 "/usr/local/etc"
  43. #endif /* NP_DEFAULT_INI_PATH2 */
  44. #ifndef NP_DEFAULT_INI_PATH3
  45. # define NP_DEFAULT_INI_PATH3 "/etc/opt"
  46. #endif /* NP_DEFAULT_INI_PATH3 */
  47. /* np_load_defaults: load the default configuration (if present) for
  48. * a plugin from the ini file
  49. */
  50. np_arg_list* np_get_defaults(const char *locator, const char *default_section);
  51. #endif /* _PARSE_INI_H_ */