New find action -hide, new find test -hidden

This commit is contained in:
Thomas Schmitt 2010-06-20 07:22:24 +00:00
parent eb5639b017
commit ec1cb90cba
11 changed files with 177 additions and 53 deletions

View File

@ -870,6 +870,25 @@ int Findjob_set_lba_range(struct FindjoB *o, int start_lba, int count,
} }
int Findjob_set_test_hidden(struct FindjoB *o, int mode, int flag)
{
struct ExprtesT *t;
int ret;
ret= Findjob_default_and(o, 0);
if(ret <= 0)
return(ret);
t= o->cursor->test;
t->test_type= 17;
t->arg1= calloc(sizeof(int), 1);
if(t->arg1 == NULL)
return(-1);
*((int *) t->arg1)= mode;
return(1);
}
/* @param value -1= files without ACL, 1= only files with ACL /* @param value -1= files without ACL, 1= only files with ACL
*/ */
int Findjob_set_acl_filter(struct FindjoB *o, int value, int flag) int Findjob_set_acl_filter(struct FindjoB *o, int value, int flag)

View File

@ -44,7 +44,8 @@ struct ExprtesT {
13= -wholename char *arg1 (regex_t in *arg2) 13= -wholename char *arg1 (regex_t in *arg2)
14= -has_any_xattr 14= -has_any_xattr
15= -has_md5 15= -has_md5
16= -disk_name 16= -disk_name char *arg1 (regex_t in *arg2)
17= -hidden int *arg1 (bit0=iso_rr, bit1=joliet)
*/ */
int test_type; int test_type;
@ -152,7 +153,7 @@ struct FindjoB {
36= make_md5 36= make_md5
37= mkisofs_r 37= mkisofs_r
38= sort_weight number 38= sort_weight number
>>> 39= hide on|iso_rr|joliet|off 39= hide on|iso_rr|joliet|off
*/ */
int action; int action;
int prune; int prune;
@ -207,6 +208,8 @@ int Findjob_set_wanted_node(struct FindjoB *o, void *wanted_node, int flag);
*/ */
int Findjob_set_damage_filter(struct FindjoB *o, int value, int flag); int Findjob_set_damage_filter(struct FindjoB *o, int value, int flag);
int Findjob_set_test_hidden(struct FindjoB *o, int mode, int flag);
int Findjob_set_decision(struct FindjoB *o, char *decision, int flag); int Findjob_set_decision(struct FindjoB *o, char *decision, int flag);

View File

@ -1743,7 +1743,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
char *abs_path, char *show_path, char *abs_path, char *show_path,
IsoNode *node, int depth, int flag) IsoNode *node, int depth, int flag)
{ {
int ret= 0, type, action= 0, hflag, deleted= 0, no_dive= 0; int ret= 0, type, action= 0, hflag, deleted= 0, no_dive= 0, hide_attrs;
uid_t user= 0; uid_t user= 0;
gid_t group= 0; gid_t group= 0;
time_t date= 0; time_t date= 0;
@ -1860,10 +1860,16 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
ret= Xorriso_mkisofs_lower_r(xorriso, node, 0); ret= Xorriso_mkisofs_lower_r(xorriso, node, 0);
} else if(action == 38) { /* sort_weight */ } else if(action == 38) { /* sort_weight */
iso_node_set_sort_weight(node, type); iso_node_set_sort_weight(node, type);
} else if(action == 38) { /* hide */ } else if(action == 39) { /* hide */
hide_attrs= 0;
/* >>> iso_node_set_hidden */; if(type) {
hide_attrs|= LIBISO_HIDE_BUT_WRITE;
if(type & 1)
hide_attrs|= LIBISO_HIDE_ON_RR;
if(type & 2)
hide_attrs|= LIBISO_HIDE_ON_JOLIET;
}
iso_node_set_hidden(node, hide_attrs);
} else { /* includes : 15 in_iso */ } else { /* includes : 15 in_iso */
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0)); sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
Xorriso_result(xorriso, 0); Xorriso_result(xorriso, 0);
@ -1915,7 +1921,7 @@ return:
*/ */
{ {
int value=0, ret, start_lba, end_lba; int value=0, ret, start_lba, end_lba;
int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i; int lba_count, *file_end_lbas= NULL, *file_start_lbas= NULL, i, mask;
void *arg1, *arg2; void *arg1, *arg2;
char ft, *decision, md5[16]; char ft, *decision, md5[16];
regmatch_t name_match; regmatch_t name_match;
@ -2091,6 +2097,20 @@ return:
break; case 16: /* -disk_name *arg1 (regex in *arg2) */ break; case 16: /* -disk_name *arg1 (regex in *arg2) */
value= !! Exprtest_match_disk_name(xorriso, ftest, node, 0); value= !! Exprtest_match_disk_name(xorriso, ftest, node, 0);
break; case 17: /* -hidden int *arg1 */
value= 0;
ret= iso_node_get_hidden(node);
mask= *((int *) arg1) & 3;
if(mask == 0 && !(ret & (LIBISO_HIDE_ON_RR | LIBISO_HIDE_ON_JOLIET)))
value= 1;
else if(mask == 1 && (ret & LIBISO_HIDE_ON_RR))
value= 1;
else if(mask == 2 && (ret & LIBISO_HIDE_ON_JOLIET))
value= 1;
else if(mask == 3 && (ret & LIBISO_HIDE_ON_RR) &&
(ret & LIBISO_HIDE_ON_JOLIET))
value= 1;
break; default: break; default:
/* >>> complain about unknown test type */; /* >>> complain about unknown test type */;

View File

@ -1179,3 +1179,17 @@ int Xorriso__bourne_to_reg(char bourne_expr[], char reg_expr[], int flag)
#endif /* ! Xorriso_fileliste_externaL */ #endif /* ! Xorriso_fileliste_externaL */
int Xorriso__hide_mode(char *mode, int flag)
{
if(strcmp(mode, "on") == 0)
return(1 | 2);
else if(strcmp(mode, "iso_rr") == 0)
return(1);
else if(strcmp(mode, "joliet") == 0)
return(2);
else if(strcmp(mode, "off") == 0)
return(0);
return(-1);
}

View File

@ -85,5 +85,7 @@ int Sregex_resolve_var(char *form, char *vars[][2], int num_vars,
int Xorriso__bourne_to_reg(char bourne_expr[], char reg_expr[], int flag); int Xorriso__bourne_to_reg(char bourne_expr[], char reg_expr[], int flag);
int Xorriso__hide_mode(char *mode, int flag);
#endif /* ! Xorriso_pvt_misc_includeD */ #endif /* ! Xorriso_pvt_misc_includeD */

View File

@ -625,14 +625,9 @@ treatment_patch:;
return(ret); return(ret);
} else if(strncmp(treatpt, "cat_hidden=", 11) == 0) { } else if(strncmp(treatpt, "cat_hidden=", 11) == 0) {
if(strcmp(treatpt + 11, "on") == 0) ret= Xorriso__hide_mode(treatpt + 11, 0);
xorriso->boot_image_cat_hidden= 1 | 2; if(ret >= 0)
else if(strcmp(treatpt + 11, "iso_rr") == 0) xorriso->boot_image_cat_hidden= ret;
xorriso->boot_image_cat_hidden= 1;
else if(strcmp(treatpt + 11, "joliet") == 0)
xorriso->boot_image_cat_hidden= 2;
else if(strcmp(treatpt + 11, "off") == 0)
xorriso->boot_image_cat_hidden= 0;
else else
was_ok= 0; was_ok= 0;

View File

@ -686,6 +686,33 @@ not_enough_arguments:;
Findjob_set_filter_filter(job, -1, 0); Findjob_set_filter_filter(job, -1, 0);
} else if(strcmp(argv[i], "-has_md5")==0) { } else if(strcmp(argv[i], "-has_md5")==0) {
Findjob_set_prop_filter(job, 15, 1, 0); Findjob_set_prop_filter(job, 15, 1, 0);
} else if(strcmp(argv[i], "-disk_name")==0) {
if(i+1>=end_idx)
goto not_enough_arguments;
i++;
ret= Findjob_set_name_expr(job, argv[i], 2);
if(ret<=0) {
sprintf(xorriso->info_text,
"-find[ix]: cannot set -disk_name expression %s",
Text_shellsafe(argv[i], sfe, 0));
goto sorry_ex;
}
} else if(strcmp(argv[i], "-hidden")==0) {
if(i + 1 >= end_idx)
goto not_enough_arguments;
i+= 1;
type= Xorriso__hide_mode(argv[i], 0);
if(type < 0) {
sprintf(xorriso->info_text, "-findi: -hidden : unknown hide state %s",
Text_shellsafe(argv[i], sfe, 0));
goto sorry_ex;
} else {
ret= Findjob_set_test_hidden(job, type, 0);
if(ret <= 0) {
sprintf(xorriso->info_text, "-findi: cannot setup -hidden test");
goto sorry_ex;
}
}
} else if(strcmp(argv[i], "-true") == 0) { } else if(strcmp(argv[i], "-true") == 0) {
ret= Findjob_set_false(job, -1, 0); ret= Findjob_set_false(job, -1, 0);
} else if(strcmp(argv[i], "-false") == 0) { } else if(strcmp(argv[i], "-false") == 0) {
@ -937,6 +964,17 @@ not_enough_exec_arguments:;
i+= 1; i+= 1;
sscanf(argv[i], "%d", &type); sscanf(argv[i], "%d", &type);
Findjob_set_action_type(job, 38, type, 0); Findjob_set_action_type(job, 38, type, 0);
} else if(strcmp(cpt, "hide")==0) {
if(i+1>=end_idx)
goto not_enough_exec_arguments;
i++;
type= Xorriso__hide_mode(argv[i], 0);
if(type < 0) {
sprintf(xorriso->info_text, "-find -exec hide: unknown hide state %s",
Text_shellsafe(argv[i], sfe, 0));
goto sorry_ex;
}
Findjob_set_action_type(job, 39, type, 0);
} else { } else {
sprintf(xorriso->info_text, "-find -exec: unknown action %s", sprintf(xorriso->info_text, "-find -exec: unknown action %s",
Text_shellsafe(argv[i], sfe, 0)); Text_shellsafe(argv[i], sfe, 0));

View File

@ -1488,6 +1488,11 @@ Matches data files which have MD5 checksums.
\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\-hidden\fR hide_state :
Matches files which are hidden in "iso_rr" tree, in "joliet" tree,
in both ("on"), or not hidden in any tree ("off"). Those who are hidden
in some tree match -not -hidden "off".
.br
\fB\-prune\fR : \fB\-prune\fR :
If this test is reached and the tested file is a directory then -find will not 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. dive into that directory. This test itself does always match.
@ -1662,6 +1667,13 @@ E.g.: -exec sort_weight 3 --
\fBshow_stream\fR \fBshow_stream\fR
shows the content stream chain of a data file. shows the content stream chain of a data file.
.br .br
\fBhide\fR
brings the file into one of the hide states "on", "iso_rr", "joliet", "off".
.br
E.g.:
.br
-find / -disk_name *_secret -exec hide on
.br
\fBfind\fR \fBfind\fR
performs another run of -find on the matching file address. performs another run of -find on the matching file address.
It accepts the same params as -find, except iso_rr_path. It accepts the same params as -find, except iso_rr_path.

View File

@ -1356,6 +1356,10 @@ File: xorriso.info, Node: CmdFind, Next: Filter, Prev: Manip, Up: Options
Matches data files which have MD5 checksums. Matches data files which have MD5 checksums.
-has_filter : -has_filter :
Matches files which are filtered by -set_filter. Matches files which are filtered by -set_filter.
-hidden hide_state :
Matches files which are hidden in "iso_rr" tree, in "joliet"
tree, in both ("on"), or not hidden in any tree ("off").
Those who are hidden in some tree match -not -hidden "off".
-prune : -prune :
If this test is reached and the tested file is a directory If this test is reached and the tested file is a directory
then -find will not dive into that directory. This test then -find will not dive into that directory. This test
@ -1494,6 +1498,11 @@ File: xorriso.info, Node: CmdFind, Next: Filter, Prev: Manip, Up: Options
E.g.: -exec sort_weight 3 -- E.g.: -exec sort_weight 3 --
show_stream show_stream
shows the content stream chain of a data file. shows the content stream chain of a data file.
hide
brings the file into one of the hide states "on", "iso_rr",
"joliet", "off".
E.g.:
-find / -disk_name *_secret -exec hide on
find find
performs another run of -find on the matching file address. performs another run of -find on the matching file address.
It accepts the same params as -find, except iso_rr_path. It accepts the same params as -find, except iso_rr_path.
@ -4075,41 +4084,41 @@ Node: Insert39576
Node: SetInsert47933 Node: SetInsert47933
Node: Manip56500 Node: Manip56500
Node: CmdFind64376 Node: CmdFind64376
Node: Filter73912 Node: Filter74319
Node: Writing78261 Node: Writing78668
Node: SetWrite84550 Node: SetWrite84957
Node: Bootable94834 Node: Bootable95241
Node: Charset102786 Node: Charset103193
Node: Exception105540 Node: Exception105947
Node: DialogCtl110055 Node: DialogCtl110462
Node: Inquiry112400 Node: Inquiry112807
Node: Navigate116540 Node: Navigate116947
Node: Verify123894 Node: Verify124301
Node: Restore132314 Node: Restore132721
Node: Emulation138970 Node: Emulation139377
Node: Scripting145843 Node: Scripting146250
Node: Frontend151405 Node: Frontend151812
Node: Examples152606 Node: Examples153013
Node: ExDevices153775 Node: ExDevices154182
Node: ExCreate154409 Node: ExCreate154816
Node: ExDialog155683 Node: ExDialog156090
Node: ExGrowing156945 Node: ExGrowing157352
Node: ExModifying157747 Node: ExModifying158154
Node: ExBootable158248 Node: ExBootable158655
Node: ExCharset158795 Node: ExCharset159202
Node: ExPseudo159623 Node: ExPseudo160030
Node: ExCdrecord160517 Node: ExCdrecord160924
Node: ExMkisofs160832 Node: ExMkisofs161239
Node: ExGrowisofs161835 Node: ExGrowisofs162242
Node: ExException162959 Node: ExException163366
Node: ExTime163413 Node: ExTime163820
Node: ExIncBackup163872 Node: ExIncBackup164279
Node: ExRestore167344 Node: ExRestore167751
Node: ExRecovery168313 Node: ExRecovery168720
Node: Files168879 Node: Files169286
Node: Seealso169917 Node: Seealso170324
Node: Legal170441 Node: Legal170848
Node: CommandIdx171363 Node: CommandIdx171770
Node: ConceptIdx184664 Node: ConceptIdx185071
 
End Tag Table End Tag Table

View File

@ -1830,6 +1830,11 @@ Matches data files which have MD5 checksums.
@item -has_filter : @item -has_filter :
Matches files which are filtered by -set_filter. Matches files which are filtered by -set_filter.
@* @*
@item -hidden hide_state :
Matches files which are hidden in "iso_rr" tree, in "joliet" tree,
in both trees ("on"), or not hidden in any tree ("off").
Those which are hidden in some tree match -not -hidden "off".
@*
@item -prune : @item -prune :
If this test is reached and the tested file is a directory then -find will not 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. dive into that directory. This test itself does always match.
@ -2022,6 +2027,13 @@ E.g.: -exec sort_weight 3 @minus{}@minus{}
@item show_stream @item show_stream
shows the content stream chain of a data file. shows the content stream chain of a data file.
@* @*
@item hide
brings the file into one of the hide states "on", "iso_rr", "joliet", "off".
@*
E.g.:
@*
-find / -disk_name *_secret -exec hide on
@*
@item find @item find
performs another run of -find on the matching file address. performs another run of -find on the matching file address.
It accepts the same params as -find, except iso_rr_path. It accepts the same params as -find, except iso_rr_path.

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.06.19.152046" #define Xorriso_timestamP "2010.06.20.072130"