/*****************************************************************************
*
* XRDDEFAULT.C - Default external state retention routines for Nagios
*
* Copyright (c) 1999-2006 Ethan Galstad (nagios@nagios.org)
* Last Modified: 04-07-2006
*
* License:
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
/*********** COMMON HEADER FILES ***********/
#include "../include/config.h"
#include "../include/common.h"
#include "../include/objects.h"
#include "../include/statusdata.h"
#include "../include/nagios.h"
#include "../include/sretention.h"
/**** STATE INFORMATION SPECIFIC HEADER FILES ****/
#include "xrddefault.h"
extern host *host_list;
extern service *service_list;
extern char *global_host_event_handler;
extern char *global_service_event_handler;
extern char *macro_x[MACRO_X_COUNT];
extern int enable_notifications;
extern int execute_service_checks;
extern int accept_passive_service_checks;
extern int execute_host_checks;
extern int accept_passive_host_checks;
extern int enable_event_handlers;
extern int obsess_over_services;
extern int obsess_over_hosts;
extern int enable_flap_detection;
extern int enable_failure_prediction;
extern int process_performance_data;
extern int check_service_freshness;
extern int check_host_freshness;
extern int use_retained_program_state;
extern int use_retained_scheduling_info;
extern int retention_scheduling_horizon;
extern unsigned long modified_host_process_attributes;
extern unsigned long modified_service_process_attributes;
char xrddefault_retention_file[MAX_FILENAME_LENGTH]="";
char xrddefault_temp_file[MAX_FILENAME_LENGTH]="";
/******************************************************************/
/********************* CONFIG INITIALIZATION *********************/
/******************************************************************/
int xrddefault_grab_config_info(char *main_config_file){
char *input=NULL;
char *temp_ptr;
mmapfile *thefile;
/* initialize the location of the retention file */
strncpy(xrddefault_retention_file,DEFAULT_RETENTION_FILE,sizeof(xrddefault_retention_file)-1);
strncpy(xrddefault_temp_file,DEFAULT_TEMP_FILE,sizeof(xrddefault_temp_file)-1);
xrddefault_retention_file[sizeof(xrddefault_retention_file)-1]='\x0';
xrddefault_temp_file[sizeof(xrddefault_temp_file)-1]='\x0';
/* open the main config file for reading */
if((thefile=mmap_fopen(main_config_file))==NULL){
#ifdef DEBUG1
printf("Error: Cannot open main configuration file '%s' for reading!\n",main_config_file);
#endif
return ERROR;
}
/* read in all lines from the main config file */
=1= |