{CIB_OP_ISMASTER,0, 0, 'M'},
{CIB_OP_ISMASTER,0, 0, 'm'},
main(int argc, char **argv){	int argerr = 0;	int flag;	char *admin_input_xml = NULL;	crm_data_t *output = NULL;	#ifdef HAVE_GETOPT_H	int option_index = 0;	static struct option long_options[] = {		/* Top-level Options */		{CIB_OP_ERASE,   0, 0, 'E'},		{CIB_OP_QUERY,   0, 0, 'Q'},		{CIB_OP_CREATE,  0, 0, 'C'},		{CIB_OP_REPLACE, 0, 0, 'R'},		{CIB_OP_UPDATE,  0, 0, 'U'},		{CIB_OP_DELETE,  0, 0, 'D'},		{CIB_OP_DELETE_ALT,  0, 0, 'd'},		{CIB_OP_BUMP,    0, 0, 'B'},		{CIB_OP_SYNC,    0, 0, 'S'},		{CIB_OP_SLAVE,   0, 0, 'r'},		{CIB_OP_MASTER,  0, 0, 'w'},		{CIB_OP_ISMASTER,0, 0, 'M'},				{"force-quorum",0, 0, 'f'},		{"local",	0, 0, 'l'},		{"sync-call",	0, 0, 's'},		{"no-bcast",	0, 0, 'b'},		{"host",	0, 0, 'h'},		{F_CRM_DATA,    1, 0, 'X'},		{"verbose",     0, 0, 'V'},		{"help",        0, 0, '?'},		{"reference",   1, 0, 0},		{"timeout",	1, 0, 't'},		/* common options */		{XML_ATTR_ID, 1, 0, 'i'},		{"obj_type", 1, 0, 'o'},		{0, 0, 0, 0}	};#endif	crm_log_init(crm_system_name);	cl_log_set_facility(LOG_USER);		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) {#ifdef HAVE_GETOPT_H			case 0:				printf("option %s",				       long_options[option_index].name);				if (optarg)					printf(" with arg %s", optarg);				printf("\n");	if (safe_str_eq("reference", long_options[option_index].name)) {		this_msg_reference = crm_strdup(optarg);	} else {		printf("Long option (--%s) is not (yet?) properly supported\n",		       long_options[option_index].name);		++argerr;	}	break;#endif			case 't':				message_timeout_ms = atoi(optarg);				if(message_timeout_ms < 1) {					message_timeout_ms = 30*1000;				}				break;							case 'E':				cib_action = CIB_OP_ERASE;				break;			case 'Q':				cib_action = CIB_OP_QUERY;				break;			case 'S':				cib_action = CIB_OP_SYNC;				break;			case 'U':				cib_action = CIB_OP_UPDATE;				break;			case 'R':				cib_action = CIB_OP_REPLACE;				break;			case 'C':				cib_action = CIB_OP_CREATE;				break;			case 'D':				cib_action = CIB_OP_DELETE;				break;			case 'd':				cib_action = CIB_OP_DELETE_ALT;				break;			case 'M':				cib_action = CIB_OP_ISMASTER;				command_options |= cib_scope_local;				break;			case 'B':				cib_action = CIB_OP_BUMP;				break;			case 'r':				cib_action = CIB_OP_SLAVE;				break;			case 'w':				cib_action = CIB_OP_MASTER;				command_options |= cib_scope_local;				break;			case 'V':				command_options = command_options | cib_verbose;				cl_log_enable_stderr(TRUE);				alter_debug(DEBUG_INC);				break;			case '?':				usage(crm_system_name, LSB_EXIT_OK);				break;			case 'i':				crm_debug_2("Option %c => %s", flag, optarg);				id = crm_strdup(optarg);				break;			case 'o':				crm_debug_2("Option %c => %s", flag, optarg);				obj_type = crm_strdup(optarg);				break;			case 'X':				admin_input_xml = crm_strdup(optarg);				break;			case 'h':				host = crm_strdup(optarg);				break;			case 'l':				command_options |= cib_scope_local;				break;			case 'b':				command_options |= cib_inhibit_bcast;				command_options |= cib_scope_local;				break;			case 's':				command_options |= cib_sync_call;				break;			case 'f':				command_options |= cib_quorum_override;				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(cib_action == NULL) {		usage(crm_system_name, cib_operation);	}		if (argerr) {		usage(crm_system_name, LSB_EXIT_GENERIC);	}	exit_code = do_init();	if(exit_code != cib_ok) {		crm_err("Init failed, could not perform requested operations");		fprintf(stderr, "Init failed, could not perform requested operations\n");		return -exit_code;	}	exit_code = do_work(admin_input_xml, command_options, &output);	if (exit_code > 0) {		/* wait for the reply by creating a mainloop and running it until		 * the callbacks are invoked...		 */		request_id = exit_code;		add_cib_op_callback(			request_id, FALSE, NULL, cibadmin_op_callback);		mainloop = g_main_new(FALSE);		crm_debug("Setting operation timeout to %dms for call %d",			  message_timeout_ms, request_id);		message_timer_id = Gmain_timeout_add(			message_timeout_ms, admin_message_timeout, NULL);		crm_debug_3("%s waiting for reply from the local CIB",			 crm_system_name);				crm_info("Starting mainloop");		g_main_run(mainloop);			} else if(exit_code < 0) {		crm_err("Call failed: %s", cib_error2string(exit_code));		fprintf(stderr, "Call failed: %s\n",			cib_error2string(exit_code));		operation_status = exit_code;	}	if(output != NULL) {		char *buffer = dump_xml_formatted(output);		fprintf(stdout, "%s", crm_str(buffer));		crm_free(buffer);	}		crm_debug_3("%s exiting normally", crm_system_name);	return -exit_code;}