Properly handle recursion in recurse()

The restructuring of recurse() in the last few weeks actually broke
the recursion-flags in different tools.
As a long-term goal, the recursor should have a field "maxdepth"
which should be "1" for the non-Rflag-case. "0" stands for unlimited.
This commit is contained in:
FRIGN
2015-04-18 21:24:17 +02:00
committed by sin
parent e2edbdcb87
commit e14d9412f8
8 changed files with 24 additions and 20 deletions

4
rm.c
View File

@@ -11,7 +11,7 @@ usage(void)
int
main(int argc, char *argv[])
{
struct recursor r = { .fn = rm, .hist = NULL, .depth = 0, .follow = 'P', .flags = 0};
struct recursor r = { .fn = rm, .hist = NULL, .depth = 0, .follow = 'P', .flags = NODIRS };
ARGBEGIN {
case 'f':
@@ -19,7 +19,7 @@ main(int argc, char *argv[])
break;
case 'R':
case 'r':
rm_rflag = 1;
r.flags &= ~NODIRS;
break;
default:
usage();