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

Function main

lib_acl_cpp/samples/dircmp/main.cpp:211–270  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

209}
210
211int main(int argc, char* argv[])
212{
213 int ch;
214 acl::string path_from, path_to;
215 acl::log::stdout_open(true);
216
217 while ((ch = getopt(argc, argv, "hf:t:")) > 0)
218 {
219 switch (ch)
220 {
221 case 'h':
222 usage(argv[0]);
223 return 0;
224 case 'f':
225 path_from = optarg;
226 break;
227 case 't':
228 path_to = optarg;
229 break;
230 default:
231 break;
232 }
233 }
234
235 if (path_from.empty() || path_to.empty())
236 {
237 usage(argv[0]);
238 return 1;
239 }
240
241 if (path_from == path_to)
242 {
243 logger_error("path_from(%s) == path_to(%s)", path_from.c_str(),
244 path_to.c_str());
245 usage(argv[0]);
246 return 1;
247 }
248
249 if (chdir(path_from.c_str()) == -1)
250 {
251 logger_error("chdir to %s error: %s",
252 path_from.c_str(), acl::last_serror());
253 return 1;
254 }
255
256 char path[256];
257 if (getcwd(path, sizeof(path)) == NULL)
258 {
259 logger_error("getcwd error: %s", path);
260 return 1;
261 }
262 logger_error("current path: %s", path);
263
264 do_cmp(".", path_to);
265
266 logger("enter any key to exit");
267 getchar();
268

Callers

nothing calls this directly

Calls 6

do_cmpFunction · 0.85
usageFunction · 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…