@@ -56,6 +56,7 @@ typedef int (*sum_file_data_t)(int fd, sum_t *dst);
int gen_manifest = 0;
int in_manifest = 0;
+int recursive = 1;
char *checksum = NULL;
struct excludes *excludes;
int n_excludes = 0;
@@ -151,6 +152,7 @@ usage(void)
fprintf(stderr, " -n : reset all flags\n");
fprintf(stderr, " -N : set all flags\n");
fprintf(stderr, " -x path : exclude path when building checksum (multiple ok)\n");
+ fprintf(stderr, " -R : traverse dirs non-recursively (recursive is default)\n");
fprintf(stderr, " -h : this help\n\n");
fprintf(stderr, "The default field mask is ugoamCdtES. If the checksum/manifest is read from a\n");
fprintf(stderr, "file, the mask is taken from there and the values given on the command line\n");
@@ -634,7 +636,7 @@ sum_one(int dirfd, int level, sum_t *dircs, char *path_prefix,
}
}
}
- if (S_ISDIR(st.st_mode)) {
+ if (S_ISDIR(st.st_mode) && recursive) {
fd = openat(dirfd, name, 0);
if (fd == -1 && flags[FLAG_OPEN_ERROR]) {
sum_add_u64(&meta, errno);
@@ -728,7 +730,7 @@ main(int argc, char *argv[])
int plen;
int elen;
int n_flags = 0;
- const char *allopts = "heEfuUgGoOaAmMcCdDtTsSnNw:r:vx:";
+ const char *allopts = "heEfuUgGoOaAmMcCdDtTsSnNRw:r:vx:";
out_fp = stdout;
while ((c = getopt(argc, argv, allopts)) != EOF) {
@@ -736,6 +738,9 @@ main(int argc, char *argv[])
case 'f':
gen_manifest = 1;
break;
+ case 'R':
+ recursive = 0;
+ break;
case 'u':
case 'U':
case 'g':