MCPcopy Create free account
hub / github.com/Meituan-Dianping/SQLAdvisor / main

Function main

mysys/test_xml.c:64–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

62}
63
64int main(int ac, char **av)
65{
66 char str[1024*64]="";
67 const char *fn;
68 int f;
69 uint len;
70 MY_XML_PARSER p;
71
72 if (ac<2)
73 {
74 usage(av[0]);
75 return 0;
76 }
77
78 fn=av[1]?av[1]:"test.xml";
79 if ((f=open(fn,O_RDONLY))<0)
80 {
81 fprintf(stderr,"Err '%s'\n",fn);
82 return 1;
83 }
84
85 len=read(f,str,sizeof(str)-1);
86 str[len]='\0';
87
88 my_xml_parser_create(&p);
89
90 my_xml_set_enter_handler(&p,bstr);
91 my_xml_set_value_handler(&p,dstr);
92 my_xml_set_leave_handler(&p,estr);
93
94 if (MY_XML_OK!=(f=my_xml_parse(&p,str,len)))
95 {
96 printf("ERROR at line %d pos %d '%s'\n",
97 my_xml_error_lineno(&p)+1,
98 my_xml_error_pos(&p),
99 my_xml_error_string(&p));
100 }
101
102 my_xml_parser_free(&p);
103
104 return 0;
105}

Callers

nothing calls this directly

Calls 10

my_xml_parser_createFunction · 0.85
my_xml_set_enter_handlerFunction · 0.85
my_xml_set_value_handlerFunction · 0.85
my_xml_set_leave_handlerFunction · 0.85
my_xml_parseFunction · 0.85
my_xml_error_linenoFunction · 0.85
my_xml_error_posFunction · 0.85
my_xml_error_stringFunction · 0.85
my_xml_parser_freeFunction · 0.85
usageFunction · 0.70

Tested by

no test coverage detected