New -find tests -maxdepth and -mindepth
This commit is contained in:
@ -2984,7 +2984,12 @@ return:
|
||||
arg2= ftest->arg2;
|
||||
|
||||
if(node == NULL) {
|
||||
if(ftest->test_type > 2 && ftest->test_type != 4) {
|
||||
switch(ftest->test_type) {
|
||||
case 0: case 1: case 2: case 4: case 11: case 12: case 13:
|
||||
case 22: case 23: case 25: case 26:
|
||||
/* Tests which need no node parameter */
|
||||
break;
|
||||
default:
|
||||
value= 0;
|
||||
goto ex;
|
||||
}
|
||||
@ -3214,6 +3219,12 @@ return:
|
||||
1 | 4);
|
||||
value= (ret == 0);
|
||||
|
||||
break; case 25: /* -maxdepth */
|
||||
value= (ftest->boss->depth <= *((int *) arg1));
|
||||
|
||||
break; case 26: /* -mindepth */
|
||||
value= (ftest->boss->depth >= *((int *) arg1));
|
||||
|
||||
break; default:
|
||||
|
||||
/* >>> complain about unknown test type */;
|
||||
@ -3296,6 +3307,8 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
int node_count= 0, node_idx;
|
||||
char *path= NULL, *abs_path= NULL;
|
||||
|
||||
job->depth= depth;
|
||||
|
||||
if(xorriso->request_to_abort)
|
||||
{ret= 0; goto ex;}
|
||||
|
||||
@ -3393,6 +3406,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
&node, hflag);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
job->depth++;
|
||||
while(1) {
|
||||
ret= Xorriso_findi_iter(xorriso, dir_node, &mem, &iter,
|
||||
&node_array, &node_count, &node_idx, &node, 0);
|
||||
@ -3472,6 +3486,7 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
|
||||
ret= 1;
|
||||
ex:;
|
||||
job->depth= depth;
|
||||
if(path!=NULL)
|
||||
free(path);
|
||||
if(abs_path!=NULL)
|
||||
|
Reference in New Issue
Block a user