oga's tools
修订版 | 178e8b7d547b5ae69023f32c464fbef6e74ceb61 (tree) |
---|---|
时间 | 2019-09-23 08:36:23 |
作者 | oga <hyperoga@gmai...> |
Commiter | oga |
DU V1.15 skip access denied error
@@ -10,6 +10,8 @@ | ||
10 | 10 | * 02/10/02 V1.12 -d (depth) support |
11 | 11 | * 05/08/31 V1.13 support large size dir |
12 | 12 | * 08/06/15 V1.14 support over 4gb file |
13 | + * 19/09/23 V1.15 skip access denied error, and expand size format | |
14 | + * | |
13 | 15 | */ |
14 | 16 | #include <windows.h> |
15 | 17 | #include <stdio.h> |
@@ -18,7 +20,7 @@ | ||
18 | 20 | #include <sys/types.h> |
19 | 21 | |
20 | 22 | /* macros */ |
21 | -#define VER "1.14" | |
23 | +#define VER "1.15" | |
22 | 24 | #define IS_DOT(str) (!strcmp(str,".") || !strcmp(str,"..")) |
23 | 25 | |
24 | 26 | #define dprintf if (vf) printf |
@@ -262,7 +264,13 @@ void Du(char *path) | ||
262 | 264 | |
263 | 265 | fh = FindFirstFile(wk,&wfd); |
264 | 266 | if (fh == INVALID_HANDLE_VALUE) { |
265 | - printf("du: FindFirstFile(%s) Error code=%d\n",wk,GetLastError()); | |
267 | + int lastst; | |
268 | + lastst = GetLastError(); | |
269 | + /* V1.15-C start */ | |
270 | + if (vf >= 2 || lastst != ERROR_ACCESS_DENIED) { | |
271 | + printf("du: FindFirstFile(%s) Error code=%d\n",wk,lastst); | |
272 | + } | |
273 | + /* V1.15-C end */ | |
266 | 274 | /* exit(1); */ |
267 | 275 | depth--; /* V1.11-A */ |
268 | 276 | return; /* V1.11-C */ |
@@ -334,7 +342,7 @@ void Du(char *path) | ||
334 | 342 | #ifdef OLD |
335 | 343 | printf("%7d",(totalb-tsvb)/1024); |
336 | 344 | #else |
337 | - printf("%7d", ans); /* V1.13-C */ | |
345 | + printf("%9d", ans); /* V1.13-C V1.15-C */ | |
338 | 346 | #endif |
339 | 347 | if (af) { |
340 | 348 | #ifdef OLD |
@@ -343,7 +351,7 @@ void Du(char *path) | ||
343 | 351 | memcpy(&work64, &total64, sizeof(u_long64)); /* V1.13-A */ |
344 | 352 | sub64(&work64, &tsv64); /* V1.13-A */ |
345 | 353 | dev1024(&work64, &ans); /* V1.13-A */ |
346 | - printf(" (%7d)", ans); /* V1.13-C */ | |
354 | + printf(" (%9d)", ans); /* V1.13-C V1.15-C */ | |
347 | 355 | #endif |
348 | 356 | } |
349 | 357 | printf(" %s\n",path); |
@@ -352,3 +360,4 @@ void Du(char *path) | ||
352 | 360 | |
353 | 361 | } /* End Du() */ |
354 | 362 | |
363 | +// vim:ts=8 |