New -find pseudo tests -use_pattern , -or_use_pattern

This commit is contained in:
2014-04-16 14:42:40 +00:00
parent a73032dd9b
commit f5d7552c22
8 changed files with 177 additions and 60 deletions

View File

@ -1,7 +1,7 @@
/* xorriso - creates, loads, manipulates and burns ISO 9660 filesystem images.
Copyright 2007-2010 Thomas Schmitt, <scdbackup@gmx.net>
Copyright 2007-2014 Thomas Schmitt, <scdbackup@gmx.net>
Provided under GPL version 2 or later.
@ -367,6 +367,7 @@ int Findjob_new(struct FindjoB **o, char *start_path, int flag)
m->use_shortcuts= 1;
m->action= 0; /* print */
m->prune= 0;
m->use_pattern= 1;
m->target= NULL; /* a mere pointer, not managed memory */
m->text_2= NULL; /* a mere pointer, not managed memory */
m->user= 0;
@ -500,6 +501,7 @@ int Findjob_new_node(struct FindjoB *job, struct ExprnodE **fnode,
/* If an operator is expected : use -and
@param flag bit0= prepare for a pseudo-test:
if an operator is expected, do nothing and return 2
bit1= use -or rather than -and
*/
int Findjob_default_and(struct FindjoB *o, int flag)
{
@ -508,7 +510,11 @@ int Findjob_default_and(struct FindjoB *o, int flag)
if(Findjob_cursor_complete(o, 0)) {
if(flag & 1)
return(2);
ret= Findjob_and(o, 0);
if(flag & 2) {
ret= Findjob_or(o, 0);
} else {
ret= Findjob_and(o, 0);
}
if(ret <= 0)
return(ret);
}
@ -1038,18 +1044,19 @@ int Findjob_set_commit_filter_2(struct FindjoB *o, int flag)
}
int Findjob_set_decision(struct FindjoB *o, char *decision, int flag)
int Findjob_set_arg1(struct FindjoB *o, int test_type, char *arg1, int flag)
{
struct ExprtesT *t;
int ret;
int ret, hflag= 0;
ret= Findjob_default_and(o, 0);
if(test_type == 23)
hflag= 2; /* prepend -or rather than -and */
ret= Findjob_default_and(o, hflag);
if(ret <= 0)
return(ret);
t= o->cursor->test;
t->test_type= 11;
t->arg1= strdup(decision);
t->test_type= test_type;
t->arg1= strdup(arg1);
if(t->arg1 == NULL)
return(-1);
return(1);