New -find tests -has_filter, -has_no_filter

This commit is contained in:
2009-04-07 12:02:53 +00:00
parent 7e3b7f3b7f
commit f9db31f5a1
5 changed files with 55 additions and 4 deletions

View File

@ -2467,7 +2467,8 @@ struct FindjoB {
int commit_filter; /* bit0= test -pending_data : uncommitted regular files */
int acl_filter; /* -1=only without ACL , 0=all , 1=only with ACL */
int xattr_filter; /* -1=only without xattr , 0=all , 1=only with xattr */
int aaip_filter; /* -1=only without AA string, 0=all , 1=only with AA */
int aaip_filter; /* -1=only without AA string , 0=all , 1=only with AA */
int filter_filter; /* -1=only unfiltered nodes , 0=all , 1=only filtered */
void *wanted_node; /* if not NULL, then only this node address matches */
@ -2500,6 +2501,7 @@ struct FindjoB {
26= getfattr
27= setfattr
28= set_filter name
29= show_stream
*/
int action;
@ -2533,6 +2535,7 @@ int Findjob_new(struct FindjoB **o, char *start_path, int flag)
m->acl_filter= 0;
m->xattr_filter= 0;
m->aaip_filter= 0;
m->filter_filter= 0;
m->wanted_node= NULL;
m->action= 0; /* print */
m->target= NULL; /* a mere pointer, not managed memory */
@ -2742,6 +2745,27 @@ int Findjob_get_aaip_filter(struct FindjoB *o, int *aaip_filter, int flag)
}
/* @param value -1= files without filter, 0= all files, 1= files with filter
*/
int Findjob_set_filter_filter(struct FindjoB *o, int value, int flag)
{
if(value < 0)
o->filter_filter= -1;
else if(value > 0)
o->filter_filter= 1;
else
o->filter_filter= 0;
return(1);
}
int Findjob_get_filter_filter(struct FindjoB *o, int *value, int flag)
{
*value= o->filter_filter;
return(1);
}
int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag)
{
o->wanted_node= wanted_node;
@ -13635,6 +13659,10 @@ not_enough_arguments:;
Findjob_set_aaip_filter(job, 1, 0);
} else if(strcmp(argv[i], "-has_no_aaip")==0) {
Findjob_set_aaip_filter(job, -1, 0);
} else if(strcmp(argv[i], "-has_filter")==0) {
Findjob_set_filter_filter(job, 1, 0);
} else if(strcmp(argv[i], "-has_no_filter")==0) {
Findjob_set_filter_filter(job, -1, 0);
} else if(strcmp(argv[i], "-exec")==0) {
if(i+1>=end_idx)
goto not_enough_arguments;
@ -14239,7 +14267,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" processed. Types: block,char,dir,pipe,file,link,socket.",
" Further tests: -damaged, -undamaged, -lba_range start count,",
" -pending_data, -has_acl, -has_no_acl, -has_xattr,",
" -has_no_xattr, -has_aaip, -has_no_aaip.",
" -has_no_xattr, -has_aaip, -has_no_aaip, -has_filter,",
" -has_no_filter.",
" Action may be one of: echo, chown, chown_r, chgrp, chgrp_r",
" chmod, chmod_r, alter_date, alter_date_r, lsdl, compare,",
" rm, rm_r, compare, update, report_damage, report_lba,",