MCPcopy Create free account
hub / github.com/Tencent/phxsql / main

Function main

phxbinlogsvr/framework/phxrpc/tools/phxbinlog_tool_main.cpp:40–87  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40int main(int argc, char * argv[]) {
41 const char * func = NULL;
42
43 for (int i = 1; i < argc - 1; i++) {
44 if (0 == strcmp(argv[i], "-f")) {
45 func = argv[++i];
46 }
47 if (0 == strcmp(argv[i], "-v")) {
48 showUsage(argv[0]);
49 }
50 }
51
52 if (NULL == func)
53 showUsage(argv[0]);
54
55 PhxbinlogTool::Name2Func_t * target = NULL;
56
57 PhxbinlogTool::Name2Func_t * name2func = PhxbinlogTool::GetName2Func();
58
59 for (int i = 0; i < 100; i++) {
60 PhxbinlogTool::Name2Func_t * iter = &(name2func[i]);
61
62 if (NULL == iter->name)
63 break;
64
65 if (0 == strcasecmp(func, iter->name)) {
66 target = iter;
67 break;
68 }
69 }
70
71 if (NULL == target)
72 showUsage(argv[0]);
73
74 OptMap opt_map(target->opt_string);
75
76 if (!opt_map.Parse(argc, argv))
77 showUsage(argv[0]);
78
79 PhxbinlogTool::ToolFunc_t targefunc = target->func;
80
81 PhxbinlogToolImpl tool;
82
83 if (0 != (tool.*targefunc)(opt_map))
84 showUsage(argv[0]);
85
86 return 0;
87}
88

Callers

nothing calls this directly

Calls 1

showUsageFunction · 0.70

Tested by

no test coverage detected