Commit b06bac1c authored by Thomas Schmitt's avatar Thomas Schmitt

New -find tests -wholename, -prune

parent 29a30488
......@@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" 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.
.\"
.\" 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.
.TP
\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.
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
......@@ -1223,9 +1223,11 @@ if all its tests match.
Available tests are:
.br
\fB\-name\fR pattern :
Pattern is not expanded but used for comparison with
the particular file names of the eventual directory tree underneath
iso_rr_path.
Matches if pattern matches the file leaf name.
.br
\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
\fB\-type\fR type_letter :
Matches files files of the given type:
......@@ -1258,9 +1260,16 @@ Matches files which have ACL or any xattr.
\fB\-has_filter\fR :
Matches files which are filtered by -set_filter.
.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" :
If this test is reached then the evaluation ends immediatly and action
is performed if the decision is not "no", "0", or "false". See operator -if.
If this test is reached then the evaluation ends immediately and action
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
Available operators are:
.br
......@@ -1277,10 +1286,9 @@ Matches if both neighboring tests or expressions match.
\fB\-or\fR :
Matches if at least one of both neighboring tests or expressions matches.
.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
is processed by neighboring operators. The same meaning have "(" and ")".
.br
is processed by neighboring operators.
Normal precedence is: -not, -or , -and.
.br
\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.
If -else is missing and would be hit, then the result is a non-match.
.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,
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
Rule keywords are:
.br
"omit_version" do not add versions (";1") to the file names.
"omit_version" do not add versions (";1") to ISO file names.
.br
"deep_paths" allow ISO file paths deeper than 8 levels.
.br
......@@ -1715,7 +1723,7 @@ Rule keywords are:
.br
"long_names" allow up to 37 characters with ISO file names.
.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
"lowercase" allow lowercase characters in ISO file names.
.br
......@@ -1742,7 +1750,7 @@ Default setting is
.br
"clear:deep_paths:long_paths:always_gmt:old_rr".
.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.
.TP
\fB\-volid\fR text
......
This diff is collapsed.
......@@ -763,7 +763,9 @@ struct ExprtesT {
8= -has_filter
9= -wanted_node IsoNode *arg1 (for internal use, arg1 not allocated)
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;
......@@ -864,6 +866,7 @@ struct FindjoB {
29= show_stream
*/
int action;
int prune;
/* action specific parameters */
char *target;
......@@ -890,14 +893,14 @@ struct FindjoB {
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);
int Exprnode_destroy(struct ExprnodE **fnode, int flag);
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);
......@@ -939,7 +942,7 @@ int Findjob_elseif(struct FindjoB *job, int flag);
int Findjob_endif(struct FindjoB *job, int flag);
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);
int Findjob_set_action_found_path(struct FindjoB *o, int flag);
......
#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
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)
/*
return:
......@@ -6801,11 +6801,18 @@ return:
}
break; case 11: /* -decision */
value= 3;
value= 2;
decision= (char *) arg1;
if(strcmp(decision, "no") == 0 || strcmp(decision, "false") == 0 ||
strcmp(decision, "0") == 0)
value= 2;
if(strcmp(decision, "yes") == 0 || strcmp(decision, "true") == 0)
value= 3;
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:
......@@ -6826,15 +6833,17 @@ ex:;
}
/* @return <0 = error , 0 = no match , 1 = match */
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,
int depth, int flag)
{
int ret;
ret= Findjob_test_2(xorriso, job, node, name, boss_stbuf, stbuf, 1);
if(ret<=0)
job->prune= 0;
ret= Findjob_test_2(xorriso, job, node, name, path, boss_stbuf, stbuf, 1);
if(ret <= 0)
return(ret);
return(1);
}
......@@ -6842,7 +6851,7 @@ int Xorriso_findi_test(struct XorrisO *xorriso, struct FindjoB *job,
#else /* Xorriso_findjob_on_expR */
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,
int depth, int flag)
{
......@@ -7026,10 +7035,12 @@ int Xorriso_findi(struct XorrisO *xorriso, struct FindjoB *job,
else
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);
if(ret<0)
goto ex;
if(job->prune)
no_dive= 1;
if(ret>0) {
ret= Xorriso_findi_action(xorriso, job,
(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.
*/
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);
if(ret<0)
goto ex;
if(job->prune)
no_dive= 1;
if(ret>0) {
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdi, path, abs_path, 1|2|4);
if(ret<=0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment