New -find tests -wholename, -prune
This commit is contained in:
parent
29a3048803
commit
b06bac1c06
@ -2,7 +2,7 @@
|
|||||||
.\" First parameter, NAME, should be all caps
|
.\" First parameter, NAME, should be all caps
|
||||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||||
.\" other parameters are allowed: see man(7), man(1)
|
.\" other parameters are allowed: see man(7), man(1)
|
||||||
.TH XORRISO 1 "Apr 21, 2009"
|
.TH XORRISO 1 "Apr 23, 2009"
|
||||||
.\" Please adjust this date whenever revising the manpage.
|
.\" Please adjust this date whenever revising the manpage.
|
||||||
.\"
|
.\"
|
||||||
.\" Some roff macros, for reference:
|
.\" Some roff macros, for reference:
|
||||||
@ -1137,7 +1137,7 @@ External filters may also be banned totally at compile time of xorriso.
|
|||||||
By default they are banned if xorriso runs under setuid permission.
|
By default they are banned if xorriso runs under setuid permission.
|
||||||
.TP
|
.TP
|
||||||
\fB\-set_filter\fR name iso_rr_path [***]
|
\fB\-set_filter\fR name iso_rr_path [***]
|
||||||
Apply an -external_filter or a built--in filter to the given data files in the
|
Apply an -external_filter or a built-in filter to the given data files in the
|
||||||
ISO image.
|
ISO image.
|
||||||
If the filter suffix is not empty , then it will be applied to the file name.
|
If the filter suffix is not empty , then it will be applied to the file name.
|
||||||
Renaming only happens if the filter really gets attached and is not revoked by
|
Renaming only happens if the filter really gets attached and is not revoked by
|
||||||
@ -1223,9 +1223,11 @@ if all its tests match.
|
|||||||
Available tests are:
|
Available tests are:
|
||||||
.br
|
.br
|
||||||
\fB\-name\fR pattern :
|
\fB\-name\fR pattern :
|
||||||
Pattern is not expanded but used for comparison with
|
Matches if pattern matches the file leaf name.
|
||||||
the particular file names of the eventual directory tree underneath
|
.br
|
||||||
iso_rr_path.
|
\fB\-wholename\fR pattern :
|
||||||
|
Matches if pattern matches the file path as it would be printed by action
|
||||||
|
"echo". Character '/' is not special but can be matched by wildcards.
|
||||||
.br
|
.br
|
||||||
\fB\-type\fR type_letter :
|
\fB\-type\fR type_letter :
|
||||||
Matches files files of the given type:
|
Matches files files of the given type:
|
||||||
@ -1258,9 +1260,16 @@ Matches files which have ACL or any xattr.
|
|||||||
\fB\-has_filter\fR :
|
\fB\-has_filter\fR :
|
||||||
Matches files which are filtered by -set_filter.
|
Matches files which are filtered by -set_filter.
|
||||||
.br
|
.br
|
||||||
|
\fB\-prune\fR :
|
||||||
|
If this test is reached and the tested file is a directory then -find will not
|
||||||
|
dive into that directory. This test itself does always match.
|
||||||
|
.br
|
||||||
\fB\-decision\fR "yes"|"no" :
|
\fB\-decision\fR "yes"|"no" :
|
||||||
If this test is reached then the evaluation ends immediatly and action
|
If this test is reached then the evaluation ends immediately and action
|
||||||
is performed if the decision is not "no", "0", or "false". See operator -if.
|
is performed if the decision is "yes" or "true". See operator -if.
|
||||||
|
.br
|
||||||
|
\fB\-true\fR and \fB\-false\fR :
|
||||||
|
Always match resp. match not. Evaluation goes on.
|
||||||
.br
|
.br
|
||||||
Available operators are:
|
Available operators are:
|
||||||
.br
|
.br
|
||||||
@ -1277,10 +1286,9 @@ Matches if both neighboring tests or expressions match.
|
|||||||
\fB\-or\fR :
|
\fB\-or\fR :
|
||||||
Matches if at least one of both neighboring tests or expressions matches.
|
Matches if at least one of both neighboring tests or expressions matches.
|
||||||
.br
|
.br
|
||||||
\fB\-sub\fR ... \fB\-subend\fR :
|
\fB\-sub\fR ... \fB\-subend\fR or \fB(\fR ... \fB)\fR :
|
||||||
Enclose a sub expression which gets evaluated first before it
|
Enclose a sub expression which gets evaluated first before it
|
||||||
is processed by neighboring operators. The same meaning have "(" and ")".
|
is processed by neighboring operators.
|
||||||
.br
|
|
||||||
Normal precedence is: -not, -or , -and.
|
Normal precedence is: -not, -or , -and.
|
||||||
.br
|
.br
|
||||||
\fB\-if\fR ... \fB\-then\fR\ ... \fB\-elseif\fR ... \fB\-then\fR ...
|
\fB\-if\fR ... \fB\-then\fR\ ... \fB\-elseif\fR ... \fB\-then\fR ...
|
||||||
@ -1293,7 +1301,7 @@ is evaluated.
|
|||||||
There may be more than one -elseif. Neither -else nor -elseif are mandatory.
|
There may be more than one -elseif. Neither -else nor -elseif are mandatory.
|
||||||
If -else is missing and would be hit, then the result is a non-match.
|
If -else is missing and would be hit, then the result is a non-match.
|
||||||
.br
|
.br
|
||||||
-if expressions are the main use case for the test -decision.
|
-if-expressions are the main use case for above test -decision.
|
||||||
|
|
||||||
Default action is \fBecho\fR,
|
Default action is \fBecho\fR,
|
||||||
i.e. to print the address of the found file. Other actions are certain
|
i.e. to print the address of the found file. Other actions are certain
|
||||||
@ -1707,7 +1715,7 @@ can be revoked individually by appending "_off". Like "deep_paths_off".
|
|||||||
.br
|
.br
|
||||||
Rule keywords are:
|
Rule keywords are:
|
||||||
.br
|
.br
|
||||||
"omit_version" do not add versions (";1") to the file names.
|
"omit_version" do not add versions (";1") to ISO file names.
|
||||||
.br
|
.br
|
||||||
"deep_paths" allow ISO file paths deeper than 8 levels.
|
"deep_paths" allow ISO file paths deeper than 8 levels.
|
||||||
.br
|
.br
|
||||||
@ -1715,7 +1723,7 @@ Rule keywords are:
|
|||||||
.br
|
.br
|
||||||
"long_names" allow up to 37 characters with ISO file names.
|
"long_names" allow up to 37 characters with ISO file names.
|
||||||
.br
|
.br
|
||||||
"no_force_dots" do not add a dot to filenames which have none.
|
"no_force_dots" do not add a dot to ISO file names which have none.
|
||||||
.br
|
.br
|
||||||
"lowercase" allow lowercase characters in ISO file names.
|
"lowercase" allow lowercase characters in ISO file names.
|
||||||
.br
|
.br
|
||||||
@ -1742,7 +1750,7 @@ Default setting is
|
|||||||
.br
|
.br
|
||||||
"clear:deep_paths:long_paths:always_gmt:old_rr".
|
"clear:deep_paths:long_paths:always_gmt:old_rr".
|
||||||
.br
|
.br
|
||||||
Note: The term "ISO file" means the plain ISO 9660 names wnd attributes
|
Note: The term "ISO file" means the plain ISO 9660 names and attributes
|
||||||
which get visible if the reader ignores Rock Ridge.
|
which get visible if the reader ignores Rock Ridge.
|
||||||
.TP
|
.TP
|
||||||
\fB\-volid\fR text
|
\fB\-volid\fR text
|
||||||
|
@ -2611,7 +2611,7 @@ int Exprnode_is_defined(struct ExprnodE *fnode, int flag)
|
|||||||
|
|
||||||
|
|
||||||
int Exprnode_own_value(struct XorrisO *xorriso, struct ExprnodE *fnode,
|
int Exprnode_own_value(struct XorrisO *xorriso, struct ExprnodE *fnode,
|
||||||
void *node, char *name,
|
void *node, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf, int flag)
|
struct stat *boss_stbuf, struct stat *stbuf, int flag)
|
||||||
/*
|
/*
|
||||||
flag:
|
flag:
|
||||||
@ -2629,9 +2629,10 @@ return: (also from Exprtest_match() and Exprnode_tree_value() )
|
|||||||
return(1);
|
return(1);
|
||||||
if(fnode->sub!=NULL) {
|
if(fnode->sub!=NULL) {
|
||||||
ret= Exprnode_tree_value(xorriso, fnode->sub, -1,
|
ret= Exprnode_tree_value(xorriso, fnode->sub, -1,
|
||||||
node, name, boss_stbuf, stbuf, 0);
|
node, name, path, boss_stbuf, stbuf, 0);
|
||||||
} else {
|
} else {
|
||||||
ret= Exprtest_match(xorriso, fnode->test, node, name, boss_stbuf, stbuf, 0);
|
ret= Exprtest_match(xorriso, fnode->test, node, name, path,
|
||||||
|
boss_stbuf, stbuf, 0);
|
||||||
}
|
}
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
return(ret);
|
return(ret);
|
||||||
@ -2656,7 +2657,7 @@ int Exprnode_op(int value1, int value2, int op, int flag)
|
|||||||
|
|
||||||
|
|
||||||
int Exprnode_tree_value(struct XorrisO *xorriso, struct ExprnodE *fnode,
|
int Exprnode_tree_value(struct XorrisO *xorriso, struct ExprnodE *fnode,
|
||||||
int left_value, void *node, char *name,
|
int left_value, void *node, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf, int flag)
|
struct stat *boss_stbuf, struct stat *stbuf, int flag)
|
||||||
/*
|
/*
|
||||||
bit0-7= testmode: 0=head , 1=filename
|
bit0-7= testmode: 0=head , 1=filename
|
||||||
@ -2686,7 +2687,7 @@ return: (also from Nntpftest_match() and Nntpfnode_own_value() )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
fnode->composed_value= fnode->own_value=
|
fnode->composed_value= fnode->own_value=
|
||||||
Exprnode_own_value(xorriso, fnode, node, name, boss_stbuf, stbuf, 0);
|
Exprnode_own_value(xorriso, fnode, node, name, path, boss_stbuf, stbuf, 0);
|
||||||
if(fnode->own_value < 0 || fnode->own_value > 1)
|
if(fnode->own_value < 0 || fnode->own_value > 1)
|
||||||
return(fnode->own_value);
|
return(fnode->own_value);
|
||||||
|
|
||||||
@ -2707,7 +2708,7 @@ return: (also from Nntpftest_match() and Nntpfnode_own_value() )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
value= Exprnode_tree_value(xorriso, fnode->right,fnode->composed_value,
|
value= Exprnode_tree_value(xorriso, fnode->right,fnode->composed_value,
|
||||||
node, name, boss_stbuf, stbuf, 0);
|
node, name, path, boss_stbuf, stbuf, 0);
|
||||||
if(value<0 || value>1)
|
if(value<0 || value>1)
|
||||||
return(value);
|
return(value);
|
||||||
fnode->composed_value= value;
|
fnode->composed_value= value;
|
||||||
@ -2725,7 +2726,7 @@ return: (also from Nntpftest_match() and Nntpfnode_own_value() )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
value= Exprnode_tree_value(xorriso, fnode->right,fnode->own_value,
|
value= Exprnode_tree_value(xorriso, fnode->right,fnode->own_value,
|
||||||
node, name, boss_stbuf, stbuf, 0);
|
node, name, path, boss_stbuf, stbuf, 0);
|
||||||
if(value<0||value>1)
|
if(value<0||value>1)
|
||||||
return(value);
|
return(value);
|
||||||
} else
|
} else
|
||||||
@ -2746,7 +2747,7 @@ ex:
|
|||||||
branch= fnode->false_branch;
|
branch= fnode->false_branch;
|
||||||
if(branch!=NULL) {
|
if(branch!=NULL) {
|
||||||
ret= Exprnode_tree_value(xorriso, branch, -1,
|
ret= Exprnode_tree_value(xorriso, branch, -1,
|
||||||
node, name, boss_stbuf, stbuf, 0);
|
node, name, path, boss_stbuf, stbuf, 0);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
return(ret);
|
return(ret);
|
||||||
if(ret>1)
|
if(ret>1)
|
||||||
@ -2775,6 +2776,7 @@ int Findjob_new(struct FindjoB **o, char *start_path, int flag)
|
|||||||
m->invert= 0;
|
m->invert= 0;
|
||||||
m->use_shortcuts= 1;
|
m->use_shortcuts= 1;
|
||||||
m->action= 0; /* print */
|
m->action= 0; /* print */
|
||||||
|
m->prune= 0;
|
||||||
m->target= NULL; /* a mere pointer, not managed memory */
|
m->target= NULL; /* a mere pointer, not managed memory */
|
||||||
m->text_2= NULL; /* a mere pointer, not managed memory */
|
m->text_2= NULL; /* a mere pointer, not managed memory */
|
||||||
m->user= 0;
|
m->user= 0;
|
||||||
@ -3153,6 +3155,8 @@ improper_range:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @param flag bit0= -wholename rather than -name
|
||||||
|
*/
|
||||||
int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag)
|
int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag)
|
||||||
{
|
{
|
||||||
char regexpr[2*SfileadrL+2];
|
char regexpr[2*SfileadrL+2];
|
||||||
@ -3167,7 +3171,7 @@ int Findjob_set_name_expr(struct FindjoB *o, char *name_expr, int flag)
|
|||||||
if(ret <= 0)
|
if(ret <= 0)
|
||||||
return(ret);
|
return(ret);
|
||||||
t= o->cursor->test;
|
t= o->cursor->test;
|
||||||
t->test_type= 1;
|
t->test_type= (flag & 1 ? 13 : 1);
|
||||||
name_re= (regex_t *) calloc(1, sizeof(regex_t));
|
name_re= (regex_t *) calloc(1, sizeof(regex_t));
|
||||||
if(name_re == NULL)
|
if(name_re == NULL)
|
||||||
return(-1);
|
return(-1);
|
||||||
@ -3365,6 +3369,15 @@ int Findjob_set_false(struct FindjoB *o, int value, int flag)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int Findjob_set_prune(struct FindjoB *o, int flag)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
ret= Findjob_set_prop_filter(o, 12, 0, 0);
|
||||||
|
return(ret);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Findjob_set_found_path(struct FindjoB *o, char *path, int flag)
|
int Findjob_set_found_path(struct FindjoB *o, char *path, int flag)
|
||||||
{
|
{
|
||||||
if(o->found_path != NULL)
|
if(o->found_path != NULL)
|
||||||
@ -3414,13 +3427,13 @@ int Findjob_get_action_parms(struct FindjoB *o, char **target, char **text_2,
|
|||||||
|
|
||||||
|
|
||||||
int Findjob_test_2(struct XorrisO *xorriso, struct FindjoB *o,
|
int Findjob_test_2(struct XorrisO *xorriso, struct FindjoB *o,
|
||||||
void *node, char *name,
|
void *node, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf, int flag)
|
struct stat *boss_stbuf, struct stat *stbuf, int flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret= Exprnode_tree_value(xorriso, o->test_tree, -1,
|
ret= Exprnode_tree_value(xorriso, o->test_tree, -1,
|
||||||
node, name, boss_stbuf, stbuf, 0);
|
node, name, path, boss_stbuf, stbuf, 0);
|
||||||
if(ret == 3)
|
if(ret == 3)
|
||||||
ret= 1;
|
ret= 1;
|
||||||
else if(ret == 2)
|
else if(ret == 2)
|
||||||
@ -10328,7 +10341,8 @@ int Xorriso_findx(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
|
|
||||||
#ifdef Xorriso_findjob_on_expR
|
#ifdef Xorriso_findjob_on_expR
|
||||||
|
|
||||||
ret= Findjob_test_2(xorriso, job, NULL, namept, NULL, dir_stbuf, 0);
|
ret= Findjob_test_2(xorriso, job, NULL, namept, dir_path, NULL, dir_stbuf,
|
||||||
|
0);
|
||||||
|
|
||||||
#else /* Xorriso_findjob_on_expR */
|
#else /* Xorriso_findjob_on_expR */
|
||||||
|
|
||||||
@ -10401,7 +10415,7 @@ int Xorriso_findx(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
|
|
||||||
#ifdef Xorriso_findjob_on_expR
|
#ifdef Xorriso_findjob_on_expR
|
||||||
|
|
||||||
ret= Findjob_test_2(xorriso, job, NULL, name, dir_stbuf, &stbuf, 0);
|
ret= Findjob_test_2(xorriso, job, NULL, name, path, dir_stbuf, &stbuf, 0);
|
||||||
|
|
||||||
#else /* Xorriso_findjob_on_expR */
|
#else /* Xorriso_findjob_on_expR */
|
||||||
|
|
||||||
@ -14753,7 +14767,7 @@ int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
|
|||||||
if(i+1>=end_idx) {
|
if(i+1>=end_idx) {
|
||||||
not_enough_arguments:;
|
not_enough_arguments:;
|
||||||
sprintf(xorriso->info_text,
|
sprintf(xorriso->info_text,
|
||||||
"-find[ix]: not enough arguments with -exec %s",
|
"-find[ix]: not enough arguments with test %s",
|
||||||
Text_shellsafe(argv[i], sfe, 0));
|
Text_shellsafe(argv[i], sfe, 0));
|
||||||
goto sorry_ex;
|
goto sorry_ex;
|
||||||
}
|
}
|
||||||
@ -14764,6 +14778,17 @@ not_enough_arguments:;
|
|||||||
Text_shellsafe(argv[i], sfe, 0));
|
Text_shellsafe(argv[i], sfe, 0));
|
||||||
goto sorry_ex;
|
goto sorry_ex;
|
||||||
}
|
}
|
||||||
|
} else if(strcmp(argv[i], "-wholename")==0) {
|
||||||
|
if(i+1>=end_idx)
|
||||||
|
goto not_enough_arguments;
|
||||||
|
i++;
|
||||||
|
ret= Findjob_set_name_expr(job, argv[i], 1);
|
||||||
|
if(ret<=0) {
|
||||||
|
sprintf(xorriso->info_text,
|
||||||
|
"-find[ix]: cannot set -wholename expression %s",
|
||||||
|
Text_shellsafe(argv[i], sfe, 0));
|
||||||
|
goto sorry_ex;
|
||||||
|
}
|
||||||
} else if(strcmp(argv[i], "-type")==0) {
|
} else if(strcmp(argv[i], "-type")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_arguments;
|
||||||
@ -14824,7 +14849,8 @@ not_enough_arguments:;
|
|||||||
goto not_enough_arguments;
|
goto not_enough_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Findjob_set_decision(job, argv[i], 0);
|
ret= Findjob_set_decision(job, argv[i], 0);
|
||||||
|
} else if(strcmp(argv[i], "-prune") == 0) {
|
||||||
|
ret= Findjob_set_prune(job, 0);
|
||||||
} else if(strcmp(argv[i], "-sub") == 0 || strcmp(argv[i], "(") == 0) {
|
} else if(strcmp(argv[i], "-sub") == 0 || strcmp(argv[i], "(") == 0) {
|
||||||
ret= Findjob_open_bracket(job, 0);
|
ret= Findjob_open_bracket(job, 0);
|
||||||
} else if(strcmp(argv[i], "-subend") == 0 || strcmp(argv[i], ")") == 0) {
|
} else if(strcmp(argv[i], "-subend") == 0 || strcmp(argv[i], ")") == 0) {
|
||||||
@ -14849,8 +14875,13 @@ not_enough_arguments:;
|
|||||||
#endif /* Xorriso_findjob_on_expR */
|
#endif /* Xorriso_findjob_on_expR */
|
||||||
|
|
||||||
} else if(strcmp(argv[i], "-exec")==0) {
|
} else if(strcmp(argv[i], "-exec")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx) {
|
||||||
goto not_enough_arguments;
|
not_enough_exec_arguments:;
|
||||||
|
sprintf(xorriso->info_text,
|
||||||
|
"-find[ix]: not enough arguments with -exec %s",
|
||||||
|
Text_shellsafe(argv[i], sfe, 0));
|
||||||
|
goto sorry_ex;
|
||||||
|
}
|
||||||
i++;
|
i++;
|
||||||
cpt= argv[i];
|
cpt= argv[i];
|
||||||
if(*cpt=='-')
|
if(*cpt=='-')
|
||||||
@ -14868,14 +14899,14 @@ not_enough_arguments:;
|
|||||||
/* >>> not implemented yet */;
|
/* >>> not implemented yet */;
|
||||||
} else if(strcmp(cpt, "mv")==0) {
|
} else if(strcmp(cpt, "mv")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i++;
|
i++;
|
||||||
Findjob_set_action_target(job, 3, argv[i], 0);
|
Findjob_set_action_target(job, 3, argv[i], 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else if(strcmp(cpt, "chown")==0 || strcmp(cpt, "chown_r")==0) {
|
} else if(strcmp(cpt, "chown")==0 || strcmp(cpt, "chown_r")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Xorriso_convert_uidstring(xorriso, argv[i], &user, 0);
|
ret= Xorriso_convert_uidstring(xorriso, argv[i], &user, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
@ -14887,7 +14918,7 @@ not_enough_arguments:;
|
|||||||
}
|
}
|
||||||
} else if(strcmp(cpt, "chgrp")==0 || strcmp(cpt, "chgrp_r")==0) {
|
} else if(strcmp(cpt, "chgrp")==0 || strcmp(cpt, "chgrp_r")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Xorriso_convert_gidstring(xorriso, argv[i], &group, 0);
|
ret= Xorriso_convert_gidstring(xorriso, argv[i], &group, 0);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
@ -14899,7 +14930,7 @@ not_enough_arguments:;
|
|||||||
}
|
}
|
||||||
} else if(strcmp(cpt, "chmod")==0 || strcmp(cpt, "chmod_r")==0) {
|
} else if(strcmp(cpt, "chmod")==0 || strcmp(cpt, "chmod_r")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Xorriso_convert_modstring(xorriso, "-find -exec chmod",
|
ret= Xorriso_convert_modstring(xorriso, "-find -exec chmod",
|
||||||
argv[i], &mode_and, &mode_or, 0);
|
argv[i], &mode_and, &mode_or, 0);
|
||||||
@ -14912,7 +14943,7 @@ not_enough_arguments:;
|
|||||||
}
|
}
|
||||||
} else if(strcmp(cpt, "alter_date")==0 || strcmp(cpt, "alter_date_r")==0){
|
} else if(strcmp(cpt, "alter_date")==0 || strcmp(cpt, "alter_date_r")==0){
|
||||||
if(i+2>=end_idx)
|
if(i+2>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i+= 2;
|
i+= 2;
|
||||||
ret= Xorriso_convert_datestring(xorriso, "-find -exec alter_date",
|
ret= Xorriso_convert_datestring(xorriso, "-find -exec alter_date",
|
||||||
argv[i-1], argv[i], &type, &date, 0);
|
argv[i-1], argv[i], &type, &date, 0);
|
||||||
@ -14937,7 +14968,7 @@ not_enough_arguments:;
|
|||||||
|
|
||||||
} else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0) {
|
} else if(strcmp(cpt, "compare")==0 || strcmp(cpt, "update")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i++;
|
i++;
|
||||||
action= 14;
|
action= 14;
|
||||||
if(strcmp(cpt, "update")==0)
|
if(strcmp(cpt, "update")==0)
|
||||||
@ -14961,7 +14992,7 @@ not_enough_arguments:;
|
|||||||
strcmp(cpt, "empty_iso_dir")==0 ||
|
strcmp(cpt, "empty_iso_dir")==0 ||
|
||||||
strcmp(cpt, "is_full_in_iso")==0) {
|
strcmp(cpt, "is_full_in_iso")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, argv[i],
|
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, argv[i],
|
||||||
other_path_start, 1|2|4);
|
other_path_start, 1|2|4);
|
||||||
@ -14992,7 +15023,7 @@ not_enough_arguments:;
|
|||||||
Findjob_set_action_target(job, 24, NULL, 0);
|
Findjob_set_action_target(job, 24, NULL, 0);
|
||||||
} else if(strcmp(cpt, "setfacl")==0) {
|
} else if(strcmp(cpt, "setfacl")==0) {
|
||||||
if(i+1>=end_idx)
|
if(i+1>=end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i++;
|
i++;
|
||||||
ret= Xorriso_normalize_acl_text(xorriso, argv[i],
|
ret= Xorriso_normalize_acl_text(xorriso, argv[i],
|
||||||
&access_acl_text, &default_acl_text, 0);
|
&access_acl_text, &default_acl_text, 0);
|
||||||
@ -15004,7 +15035,7 @@ not_enough_arguments:;
|
|||||||
Findjob_set_action_target(job, 26, NULL, 0);
|
Findjob_set_action_target(job, 26, NULL, 0);
|
||||||
} else if(strcmp(cpt, "setfattr")==0) {
|
} else if(strcmp(cpt, "setfattr")==0) {
|
||||||
if(i + 2 >= end_idx)
|
if(i + 2 >= end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i+= 2;
|
i+= 2;
|
||||||
/* check input */
|
/* check input */
|
||||||
ret= Xorriso_path_setfattr(xorriso, NULL, "", argv[i - 1],
|
ret= Xorriso_path_setfattr(xorriso, NULL, "", argv[i - 1],
|
||||||
@ -15014,7 +15045,7 @@ not_enough_arguments:;
|
|||||||
Findjob_set_action_text_2(job, 27, argv[i - 1], argv[i], 0);
|
Findjob_set_action_text_2(job, 27, argv[i - 1], argv[i], 0);
|
||||||
} else if(strcmp(cpt, "set_filter")==0) {
|
} else if(strcmp(cpt, "set_filter")==0) {
|
||||||
if(i + 1 >= end_idx)
|
if(i + 1 >= end_idx)
|
||||||
goto not_enough_arguments;
|
goto not_enough_exec_arguments;
|
||||||
i+= 1;
|
i+= 1;
|
||||||
Findjob_set_action_target(job, 28, argv[i], 0);
|
Findjob_set_action_target(job, 28, argv[i], 0);
|
||||||
if(!(flag&2)) {
|
if(!(flag&2)) {
|
||||||
@ -15447,9 +15478,10 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" -find iso_rr_path [test [op] [test ...]] [-exec action [params]]",
|
" -find iso_rr_path [test [op] [test ...]] [-exec action [params]]",
|
||||||
" performs an action on files below the given directory in",
|
" performs an action on files below the given directory in",
|
||||||
" the ISO image. Tests:",
|
" the ISO image. Tests:",
|
||||||
" -name pattern, -type b|c|d|p|f|l|s|e, -pending_data,",
|
" -name pattern, -wholename pattern, -type b|c|d|p|f|l|s|e,",
|
||||||
" -lba_range start count, -damaged, -has_acl, -has_xattr,",
|
" -pending_data, -lba_range start count, -damaged,",
|
||||||
" -has_aaip, -has_filter, -decision yes|no",
|
" -has_acl, -has_xattr, -has_aaip, -has_filter,",
|
||||||
|
" -prune, -decision yes|no, -true, -false",
|
||||||
" Operators: -not, -or, -and, -sub, (, -subend, ),",
|
" Operators: -not, -or, -and, -sub, (, -subend, ),",
|
||||||
" -if, -then, -elseif, -else, -endif",
|
" -if, -then, -elseif, -else, -endif",
|
||||||
" Action may be one of: echo, chown, chown_r, chgrp, chgrp_r",
|
" Action may be one of: echo, chown, chown_r, chgrp, chgrp_r",
|
||||||
@ -15458,7 +15490,6 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
" getfacl, setfacl, getfattr, setfattr, set_filter,",
|
" getfacl, setfacl, getfattr, setfattr, set_filter,",
|
||||||
" show_stream, find.",
|
" show_stream, find.",
|
||||||
" params are their arguments except iso_rr_path.",
|
" params are their arguments except iso_rr_path.",
|
||||||
" echo, lsdl, rm, rm_r, report_damage have no params at all.",
|
|
||||||
" -mkdir iso_rr_path [...]",
|
" -mkdir iso_rr_path [...]",
|
||||||
" Create empty directories if they do not exist yet.",
|
" Create empty directories if they do not exist yet.",
|
||||||
" -rmdir iso_rr_path [***]",
|
" -rmdir iso_rr_path [***]",
|
||||||
@ -15599,9 +15630,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
|
|||||||
"",
|
"",
|
||||||
" -findx disk_path [-name pattern] [-type t] [-exec action [params]]",
|
" -findx disk_path [-name pattern] [-type t] [-exec action [params]]",
|
||||||
" Like -find but operating on local filesystem. Most -exec",
|
" Like -find but operating on local filesystem. Most -exec",
|
||||||
" actions are defaulted to action is always echo. Supported",
|
" actions are defaulted to action echo. Supported actions are:",
|
||||||
" actions are: in_iso, not_in_iso, is_full_in_iso,",
|
" in_iso, not_in_iso, is_full_in_iso, add_missing,",
|
||||||
" add_missing, empty_iso_dir.",
|
" empty_iso_dir",
|
||||||
"",
|
"",
|
||||||
" -compare disk_path iso_rr_path",
|
" -compare disk_path iso_rr_path",
|
||||||
" compare attributes and in case of regular data files the",
|
" compare attributes and in case of regular data files the",
|
||||||
|
@ -763,7 +763,9 @@ struct ExprtesT {
|
|||||||
8= -has_filter
|
8= -has_filter
|
||||||
9= -wanted_node IsoNode *arg1 (for internal use, arg1 not allocated)
|
9= -wanted_node IsoNode *arg1 (for internal use, arg1 not allocated)
|
||||||
10= -pending_data
|
10= -pending_data
|
||||||
11= -decision *arg1 ("y", "1", "n", "0")
|
11= -decision char *arg1 ("yes", "no")
|
||||||
|
12= -prune
|
||||||
|
13= -wholename char *arg1 (regex_t in *arg2)
|
||||||
*/
|
*/
|
||||||
int test_type;
|
int test_type;
|
||||||
|
|
||||||
@ -864,6 +866,7 @@ struct FindjoB {
|
|||||||
29= show_stream
|
29= show_stream
|
||||||
*/
|
*/
|
||||||
int action;
|
int action;
|
||||||
|
int prune;
|
||||||
|
|
||||||
/* action specific parameters */
|
/* action specific parameters */
|
||||||
char *target;
|
char *target;
|
||||||
@ -890,14 +893,14 @@ struct FindjoB {
|
|||||||
|
|
||||||
|
|
||||||
int Exprtest_match(struct XorrisO *xorriso, struct ExprtesT *ftest,
|
int Exprtest_match(struct XorrisO *xorriso, struct ExprtesT *ftest,
|
||||||
void *node_pt, char *name,
|
void *node_pt, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf, int flag);
|
struct stat *boss_stbuf, struct stat *stbuf, int flag);
|
||||||
|
|
||||||
|
|
||||||
int Exprnode_destroy(struct ExprnodE **fnode, int flag);
|
int Exprnode_destroy(struct ExprnodE **fnode, int flag);
|
||||||
|
|
||||||
int Exprnode_tree_value(struct XorrisO *xorriso, struct ExprnodE *fnode,
|
int Exprnode_tree_value(struct XorrisO *xorriso, struct ExprnodE *fnode,
|
||||||
int left_value, void *node, char *name,
|
int left_value, void *node, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf, int flag);
|
struct stat *boss_stbuf, struct stat *stbuf, int flag);
|
||||||
|
|
||||||
|
|
||||||
@ -939,7 +942,7 @@ int Findjob_elseif(struct FindjoB *job, int flag);
|
|||||||
int Findjob_endif(struct FindjoB *job, int flag);
|
int Findjob_endif(struct FindjoB *job, int flag);
|
||||||
|
|
||||||
int Findjob_test_2(struct XorrisO *xorriso, struct FindjoB *o,
|
int Findjob_test_2(struct XorrisO *xorriso, struct FindjoB *o,
|
||||||
void *node, char *name,
|
void *node, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf, int flag);
|
struct stat *boss_stbuf, struct stat *stbuf, int flag);
|
||||||
|
|
||||||
int Findjob_set_action_found_path(struct FindjoB *o, int flag);
|
int Findjob_set_action_found_path(struct FindjoB *o, int flag);
|
||||||
|
@ -1 +1 @@
|
|||||||
#define Xorriso_timestamP "2009.04.22.173648"
|
#define Xorriso_timestamP "2009.04.23.103301"
|
||||||
|
@ -6635,7 +6635,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
#ifdef Xorriso_findjob_on_expR
|
#ifdef Xorriso_findjob_on_expR
|
||||||
|
|
||||||
int Exprtest_match(struct XorrisO *xorriso, struct ExprtesT *ftest,
|
int Exprtest_match(struct XorrisO *xorriso, struct ExprtesT *ftest,
|
||||||
void *node_pt, char *name,
|
void *node_pt, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf, int flag)
|
struct stat *boss_stbuf, struct stat *stbuf, int flag)
|
||||||
/*
|
/*
|
||||||
return:
|
return:
|
||||||
@ -6801,11 +6801,18 @@ return:
|
|||||||
}
|
}
|
||||||
|
|
||||||
break; case 11: /* -decision */
|
break; case 11: /* -decision */
|
||||||
value= 3;
|
value= 2;
|
||||||
decision= (char *) arg1;
|
decision= (char *) arg1;
|
||||||
if(strcmp(decision, "no") == 0 || strcmp(decision, "false") == 0 ||
|
if(strcmp(decision, "yes") == 0 || strcmp(decision, "true") == 0)
|
||||||
strcmp(decision, "0") == 0)
|
value= 3;
|
||||||
value= 2;
|
|
||||||
|
break; case 12: /* -prune */
|
||||||
|
value= 1;
|
||||||
|
ftest->boss->prune= 1;
|
||||||
|
|
||||||
|
break; case 13: /* -wholename *arg1 (regex in *arg2) */
|
||||||
|
ret= regexec(arg2, path, 1, &name_match, 0);
|
||||||
|
value= !ret;
|
||||||
|
|
||||||
break; default:
|
break; default:
|
||||||
|
|
||||||
@ -6826,15 +6833,17 @@ ex:;
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @return <0 = error , 0 = no match , 1 = match */
|
||||||
int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job,
|
int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job,
|
||||||
IsoNode *node, char *name,
|
IsoNode *node, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf,
|
struct stat *boss_stbuf, struct stat *stbuf,
|
||||||
int depth, int flag)
|
int depth, int flag)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
ret= Findjob_test_2(xorriso, job, node, name, boss_stbuf, stbuf, 1);
|
job->prune= 0;
|
||||||
if(ret<=0)
|
ret= Findjob_test_2(xorriso, job, node, name, path, boss_stbuf, stbuf, 1);
|
||||||
|
if(ret <= 0)
|
||||||
return(ret);
|
return(ret);
|
||||||
return(1);
|
return(1);
|
||||||
}
|
}
|
||||||
@ -6842,7 +6851,7 @@ int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
#else /* Xorriso_findjob_on_expR */
|
#else /* Xorriso_findjob_on_expR */
|
||||||
|
|
||||||
int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job,
|
int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job,
|
||||||
IsoNode *node, char *name,
|
IsoNode *node, char *name, char *path,
|
||||||
struct stat *boss_stbuf, struct stat *stbuf,
|
struct stat *boss_stbuf, struct stat *stbuf,
|
||||||
int depth, int flag)
|
int depth, int flag)
|
||||||
{
|
{
|
||||||
@ -7026,10 +7035,12 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
else
|
else
|
||||||
name++;
|
name++;
|
||||||
|
|
||||||
ret= Xorriso_findi_test(xorriso, job, iso_node, name, NULL, dir_stbuf,
|
ret= Xorriso_findi_test(xorriso, job, iso_node, name, path, NULL, dir_stbuf,
|
||||||
depth, 0);
|
depth, 0);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
goto ex;
|
goto ex;
|
||||||
|
if(job->prune)
|
||||||
|
no_dive= 1;
|
||||||
if(ret>0) {
|
if(ret>0) {
|
||||||
ret= Xorriso_findi_action(xorriso, job,
|
ret= Xorriso_findi_action(xorriso, job,
|
||||||
(IsoDirIter *) boss_iter, boss_mem,
|
(IsoDirIter *) boss_iter, boss_mem,
|
||||||
@ -7095,10 +7106,12 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
|
|||||||
handling of the find start path with mount points. Dangerous to change.
|
handling of the find start path with mount points. Dangerous to change.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ret= Xorriso_findi_test(xorriso, job, node, name, dir_stbuf, &stbuf,
|
ret= Xorriso_findi_test(xorriso, job, node, name, path, dir_stbuf, &stbuf,
|
||||||
depth, 0);
|
depth, 0);
|
||||||
if(ret<0)
|
if(ret<0)
|
||||||
goto ex;
|
goto ex;
|
||||||
|
if(job->prune)
|
||||||
|
no_dive= 1;
|
||||||
if(ret>0) {
|
if(ret>0) {
|
||||||
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, path, abs_path, 1|2|4);
|
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, path, abs_path, 1|2|4);
|
||||||
if(ret<=0)
|
if(ret<=0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user