MCPcopy Create free account
hub / github.com/ClusterLabs/pacemaker / main

Function main

scratch.c:36–83  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

34#define OPTARGS "V?X:I:"
35
36int
37main(int argc, char **argv)
38{
39 int flag;
40 xmlNode *top = NULL;
41 xmlNode *xml = NULL;
42 const char *xml_file = NULL;
43 const char *xpath = NULL;
44
45 crm_log_init(NULL, LOG_DEBUG, FALSE, TRUE, argc, argv, FALSE);
46 while (1) {
47 flag = getopt(argc, argv, OPTARGS);
48 if (flag == -1)
49 break;
50
51 switch (flag) {
52 case 'X':
53 xml_file = optarg;
54 break;
55 case 'I':
56 xpath = optarg;
57 break;
58 case '?':
59 /* usage("ptest", 0); */
60 break;
61 default:
62 printf("?? getopt returned character code 0%o ??\n", flag);
63 break;
64 }
65 }
66
67 top = filename2xml(xml_file);
68 validate_xml(top, NULL, FALSE);
69
70 if (xpath) {
71 xml = get_xpath_object(xpath, top, LOG_ERR);
72 }
73
74 if (xml) {
75 char *buf = dump_xml_formatted(xml);
76
77 printf("%s\n", buf);
78 free(buf);
79 }
80
81 free_xml(top);
82 return 0;
83}

Callers

nothing calls this directly

Calls 6

crm_log_initFunction · 0.85
filename2xmlFunction · 0.85
validate_xmlFunction · 0.85
get_xpath_objectFunction · 0.85
dump_xml_formattedFunction · 0.85
free_xmlFunction · 0.85

Tested by

no test coverage detected