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

Function do_cmp

lib_acl_cpp/samples/dircmp/main.cpp:158–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156}
157
158static void do_cmp(const acl::string& from, const acl::string& to)
159{
160 acl::scan_dir scan;
161 if (scan.open(from.c_str()) == false)
162 {
163 logger_error("open path: %s error: %s",
164 from.c_str(), acl::last_serror());
165 return;
166 }
167
168 const char* name;
169 bool is_file;
170 int nfiles = 0, ndirs = 0, nfiles_diff = 0, ndirs_diff = 0;
171 while ((name = scan.next(false, &is_file)) != NULL)
172 {
173 SKIP(name);
174
175 if (is_file)
176 {
177 if (cmp_file(scan, name, to, &nfiles_diff) == false)
178 {
179 printf(">>cmp failed, name: %s\r\n", name);
180 break;
181 }
182 nfiles++;
183 }
184 else if (check_dir(scan, to, &ndirs_diff) == false)
185 {
186 printf(">>check_dir failed, name: %s\r\n", name);
187 break;
188 }
189 else
190 ndirs++;
191
192 if ((nfiles + ndirs) % 100 == 0)
193 {
194 printf("current file count: diff %d / scaned %d, "
195 "dir count: diff %d / scaned %d\r",
196 nfiles_diff, nfiles, ndirs_diff, ndirs);
197 fflush(stdout);
198 }
199 }
200
201 printf("total file count: diff %d / scaned %d, dir count: "
202 "diff %d / scaned %d\r\n", nfiles_diff, nfiles,
203 ndirs_diff, ndirs);
204}
205
206static void usage(const char* procname)
207{

Callers 1

mainFunction · 0.85

Calls 6

cmp_fileFunction · 0.85
check_dirFunction · 0.70
last_serrorFunction · 0.50
openMethod · 0.45
c_strMethod · 0.45
nextMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…