MCPcopy Create free account
hub / github.com/acl-dev/acl / main

Function main

lib_acl_cpp/samples/json/json12/json.cpp:77–128  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75}
76
77int main(int argc, char* argv[])
78{
79 acl::string filepath, name;
80 int ch;
81 bool once = false;
82
83 while ((ch = getopt(argc, argv, "hf:on:")) > 0)
84 {
85 switch (ch)
86 {
87 case 'h':
88 usage(argv[0]);
89 return 0;
90 case 'f':
91 filepath = optarg;
92 break;
93 case 'o':
94 once = true;
95 break;
96 case 'n':
97 name = optarg;
98 break;
99 default:
100 break;
101 }
102 }
103
104 if (filepath.empty())
105 {
106 usage(argv[0]);
107 return 0;
108 }
109
110 acl::string buf;
111
112 if (acl::ifstream::load(filepath, &buf) == false)
113 {
114 printf("load %s error %s\r\n", filepath.c_str(),
115 acl::last_serror());
116 return 0;
117 }
118
119 if (test(buf, once, name) == false)
120 {
121 printf("test json %s error\r\n", filepath.c_str());
122 return 1;
123 }
124
125 printf("test ALL OK\r\n");
126
127 return 0;
128}

Callers

nothing calls this directly

Calls 6

usageFunction · 0.70
testFunction · 0.70
getoptFunction · 0.50
last_serrorFunction · 0.50
emptyMethod · 0.45
c_strMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…