stonith_set_config_file(Stonith* s, const char * configname)
{
	FILE *		cfgfile;

	char		line[1024];

	if ((cfgfile = fopen(configname, "r")) == NULL)  {
		LOG(PIL_CRIT, "Cannot open %s", configname);
		return(S_BADCONFIG);
	}
	while (fgets(line, sizeof(line), cfgfile) != NULL){
		int	len;
		
		if (*line == '#' || *line == '\n' || *line == EOS) {
			continue;
		}
		
		/*remove the new line in the end*/
		len = strnlen(line, sizeof(line)-1);
		if (line[len-1] == '\n'){
			line[len-1] = '\0';
		}else{
			line[len] = '\0';
		}
	
		fclose(cfgfile);
		return stonith_set_config_info(s, line);
	}
	fclose(cfgfile);
	return S_BADCONFIG;
}
stonith_set_config_file(Stonith* s, const char * configname)
{
	FILE *		cfgfile;

	char		line[1024];

	if ((cfgfile = fopen(configname, "r")) == NULL)  {
		LOG(PIL_CRIT, "Cannot open %s", configname);
		return(S_BADCONFIG);
	}
	while (fgets(line, sizeof(line), cfgfile) != NULL){
		int	len;
		
		if (*line == '#' || *line == '\n' || *line == EOS) {
			continue;
		}
		
		 
		len = strnlen(line, sizeof(line)-1);
		if (line[len-1] == '\n'){
			line[len-1] = '\0';
		}else{
			line[len] = '\0';
		}
	
		fclose(cfgfile);
		return stonith_set_config_info(s, line);
	}
	fclose(cfgfile);
	return S_BADCONFIG;
}