91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 2.79MB
    文件類型: .gz
    金幣: 1
    下載: 0 次
    發(fā)布日期: 2023-09-09
  • 語言: 其他
  • 標(biāo)簽: pnp4nagios??

資源簡介

nagios畫圖

資源截圖

代碼片段和文件信息

//?Copyright?(C)?2007-2009?Hendrik?Baecker?
//?Inspired?by?Ethan?Galstad?
//
//?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.?51?Franklin?St?Fifth?Floor?Boston?MA??02110-1301??USA

#include?“../include/config.h“
#include?“../include/pnp.h“

#include?

extern?void?pnp_strip(char?*);

extern?char?*macro_x[CONFIG_OPT_COUNT];
extern?char?*log_file?*log_type;
extern?char?*command?*command_args?*user?*group?*directory?*pidfile;
extern?int?daemon_mode;
extern?int?sighup_detected;
extern?int?use_syslog;
extern?int?loglevel;
extern?int?max_logfile_size;
extern?int?max_threads;
extern?int?use_load_threshold;
extern?int?sleeptime;
extern?int?identmyself;
extern?double?load_threshold;

void?process_configfile(char?*config_file)?{
FILE?*fh_config_file?=?NULL;
char?current_config_line[MAX_BUFFER_SIZE];
char?error_msg[MAX_BUFFER_SIZE];
char?variable[MAX_VARIABLE_LENGTH];
char?value[MAX_VALUE_LENGTH];
//?char?*input?=?NULL;
char?*temp;
extern?int?loglevel;

int?error?=?FALSE;
//?int?warning?=?FALSE;
int?line_number?=?0;

fh_config_file?=?fopen(config_file?(const?char*)?“r“);

/*?check?if?we?can?not?open?that?file?*/
if?(fh_config_file?==?NULL)?{
snprintf(error_msg?MAX_BUFFER_SIZE
“ERROR?-?Could?not?open?config?file?-?%s“?strerror(errno));
error?=?TRUE;
}

/*?ok?-?parsing?the?config?file?line?by?line?*/
else?{
while?(feof(fh_config_file)?==?0)?{
line_number++;
temp?=?fgets(current_config_line?1024?fh_config_file);
temp?=?NULL;
if?(current_config_line?==?NULL)?{
printf(“Error?reading?config\n“);
exit(1);
}

if?(current_config_line[0]?==?‘#‘?||?current_config_line[0]?==?‘\n‘)
continue;

pnp_strip(current_config_line);

temp?=?strtok(current_config_line?“=“);
pnp_strip(temp);

/*?if?there?is?no?variable?name?return?error?*/
if?(temp?==?NULL)?{
strcpy(error_msg?“No?variable?found?-?exiting“);
error?=?TRUE;
break;
}

/*?else?the?variable?is?good?*/
strncpy(variable?temp?sizeof(variable));
variable[sizeof(variable)?-?1]?=?‘\x0‘;

/*?get?the?value?*/
temp?=?strtok(NULL?“\n“);
pnp_strip(temp);
/*?if?no?value?exists?return?error?*/
if?(temp?==?NULL)?{
strcpy(error_msg?“NULL?value“);
error?=?TRUE;
break;
}

/*?else?the?value?is?good?*/
strncpy(value?temp?sizeof(value));
value[sizeof(value)?-?1]?=?‘\x0‘;
pnp_strip(value);

/

評論

共有 條評論

相關(guān)資源