gboolean apply = TRUE;
gboolean apply = FALSE;
main(int argc, char **argv){	gboolean apply = TRUE;	gboolean raw_1  = FALSE;	gboolean raw_2  = FALSE;	gboolean filter = FALSE;	gboolean use_stdin = FALSE;	gboolean as_cib = FALSE;	int argerr = 0;	int flag;	crm_data_t *object_1 = NULL;	crm_data_t *object_2 = NULL;	crm_data_t *output = NULL;	const char *xml_file_1 = NULL;	const char *xml_file_2 = NULL;	#ifdef HAVE_GETOPT_H	int option_index = 0;	static struct option long_options[] = {		/* Top-level Options */		{"original", 1, 0, 'o'},		{"new",      1, 0, 'n'},		{"original-string", 1, 0, 'O'},		{"new-string",      1, 0, 'N'},		{"patch",    1, 0, 'p'},		{"stdin",    0, 0, 's'},		{"cib",      0, 0, 'c'},		{"verbose",  0, 0, 'V'},		{"help",     0, 0, '?'},		{0, 0, 0, 0}	};#endif	cl_log_set_entity(crm_system_name);	cl_log_set_facility(LOG_USER);	set_crm_log_level(LOG_CRIT-1);		if(argc < 2) {		usage(crm_system_name, LSB_EXIT_EINVAL);	}	while (1) {#ifdef HAVE_GETOPT_H		flag = getopt_long(argc, argv, OPTARGS,				   long_options, &option_index);#else		flag = getopt(argc, argv, OPTARGS);#endif		if (flag == -1)			break;		switch(flag) {			case 'o':				xml_file_1 = optarg;				break;			case 'O':				xml_file_1 = optarg;				raw_1 = TRUE;				break;			case 'n':				xml_file_2 = optarg;				apply = FALSE;				break;			case 'N':				xml_file_2 = optarg;				raw_2 = TRUE;				break;			case 'p':				xml_file_2 = optarg;				apply = TRUE;				break;			case 'f':				filter = TRUE;				break;			case 's':				use_stdin = TRUE;				break;			case 'c':				as_cib = TRUE;				break;			case 'V':				cl_log_enable_stderr(TRUE);				alter_debug(DEBUG_INC);				break;							default:				printf("Argument code 0%o (%c)"				       " is not (?yet?) supported\n",				       flag, flag);				++argerr;				break;		}	}	if (optind < argc) {		printf("non-option ARGV-elements: ");		while (optind < argc)			printf("%s ", argv[optind++]);		printf("\n");	}	if (optind > argc) {		++argerr;	}	if (argerr) {		usage(crm_system_name, LSB_EXIT_GENERIC);	}	if(raw_1) {		object_1 = string2xml(xml_file_1);	} else if(use_stdin) {		fprintf(stderr, "Input first XML fragment:");		object_1 = stdin2xml();	} else if(xml_file_1 != NULL) {		FILE *xml_strm = fopen(xml_file_1, "r");		if(xml_strm != NULL) {			crm_debug("Reading: %s", xml_file_1);			object_1 = file2xml(xml_strm);		} else {			cl_perror("File not found: %s", xml_file_1);		}	}		if(raw_1) {		object_2 = string2xml(xml_file_2);	} else if(use_stdin) {		fprintf(stderr, "Input second XML fragment:");		object_2 = stdin2xml();	} else if(xml_file_1 != NULL) {		FILE *xml_strm = fopen(xml_file_2, "r");		if(xml_strm != NULL) {			crm_debug("Reading: %s", xml_file_2);			object_2 = file2xml(xml_strm);		} else {			cl_perror("File not found: %s", xml_file_2);		}			}	CRM_ASSERT(object_1 != NULL);	CRM_ASSERT(object_2 != NULL);	if(as_cib == FALSE) {		if(apply) {			apply_xml_diff(object_1, object_2, &output);		} else {			output = diff_xml_object(object_1, object_2, filter);		}	} else {		if(apply) {			apply_cib_diff(object_1, object_2, &output);		} else {			output = diff_cib_object(object_1, object_2, filter);		}	}			if(output != NULL) {		char *buffer = dump_xml_formatted(output);		fprintf(stdout, "%s", crm_str(buffer));		crm_free(buffer);	}	if(apply == FALSE && output != NULL) {		return 1;	}		return 0;	}