bound on the size to display a
file/dir */
-int ignore_protected_files = 0; /* Should we simply ignore files or
- directories which are protected
- ? */
+int dont_exit_on_protected_files = 0; /* Should we go on when we meet
+ files or directories which
+ are protected ? */
/********************************************************************/
if(isdir) { *isdir = 0; }
if(lstat(name, &dummy) != 0) {
- if(!(errno == EACCES && ignore_protected_files)) {
- fprintf(stderr,
- "dus: Can not stat %s: %s\n",
- name, strerror(errno));
+ fprintf(stderr,
+ "dus: Can not stat %s: %s\n",
+ name, strerror(errno));
+ if(!(errno == EACCES && dont_exit_on_protected_files)) {
exit(EXIT_FAILURE);
} else {
return 0;
}
closedir(dir);
} else {
- if(!(errno == EACCES && ignore_protected_files)) {
- fprintf(stderr,
- "dus: Can not open directory %s: %s\n",
- name, strerror(errno));
+ fprintf(stderr,
+ "dus: Can not open directory %s: %s\n",
+ name, strerror(errno));
+ if(!(errno == EACCES && dont_exit_on_protected_files)) {
exit(EXIT_FAILURE);
}
}
fprintf(out, " -h, --help show this help.\n");
fprintf(out, " -v, --version prints the version number and exit\n");
fprintf(out, " -d, --ignore-dots ignore files and directories starting with a '.'\n");
- fprintf(out, " -i, --ignore-protected ignore files and directories for which we do not\n");
- fprintf(out, " have permission\n");
+ fprintf(out, " -i, --ignore-protected do not exit when visiting files and directories\n");
+ fprintf(out, " for which we do not have permission\n");
fprintf(out, " -f, --fancy display size with float values and K, M and G\n");
fprintf(out, " units.\n");
fprintf(out, " -r, --reverse-order reverse the sorting order.\n");
break;
case 'i':
- ignore_protected_files = 1;
+ dont_exit_on_protected_files = 1;
break;
case 'f':