New find action -hide, new find test -hidden
This commit is contained in:
parent
eb5639b017
commit
ec1cb90cba
@ -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
|
||||
*/
|
||||
int Findjob_set_acl_filter(struct FindjoB *o, int value, int flag)
|
||||
|
@ -44,7 +44,8 @@ struct ExprtesT {
|
||||
13= -wholename char *arg1 (regex_t in *arg2)
|
||||
14= -has_any_xattr
|
||||
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;
|
||||
|
||||
@ -152,7 +153,7 @@ struct FindjoB {
|
||||
36= make_md5
|
||||
37= mkisofs_r
|
||||
38= sort_weight number
|
||||
>>> 39= hide on|iso_rr|joliet|off
|
||||
39= hide on|iso_rr|joliet|off
|
||||
*/
|
||||
int action;
|
||||
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_test_hidden(struct FindjoB *o, int mode, int flag);
|
||||
|
||||
|
||||
int Findjob_set_decision(struct FindjoB *o, char *decision, int flag);
|
||||
|
||||
|
@ -1743,7 +1743,7 @@ int Xorriso_findi_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
char *abs_path, char *show_path,
|
||||
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;
|
||||
gid_t group= 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);
|
||||
} else if(action == 38) { /* sort_weight */
|
||||
iso_node_set_sort_weight(node, type);
|
||||
} else if(action == 38) { /* hide */
|
||||
|
||||
/* >>> iso_node_set_hidden */;
|
||||
|
||||
} else if(action == 39) { /* hide */
|
||||
hide_attrs= 0;
|
||||
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 */
|
||||
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(show_path, sfe, 0));
|
||||
Xorriso_result(xorriso, 0);
|
||||
@ -1915,7 +1921,7 @@ return:
|
||||
*/
|
||||
{
|
||||
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;
|
||||
char ft, *decision, md5[16];
|
||||
regmatch_t name_match;
|
||||
@ -2091,6 +2097,20 @@ return:
|
||||
break; case 16: /* -disk_name *arg1 (regex in *arg2) */
|
||||
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:
|
||||
|
||||
/* >>> complain about unknown test type */;
|
||||
|
@ -1179,3 +1179,17 @@ int Xorriso__bourne_to_reg(char bourne_expr[], char reg_expr[], int flag)
|
||||
|
||||
#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);
|
||||
}
|
||||
|
||||
|
@ -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__hide_mode(char *mode, int flag);
|
||||
|
||||
#endif /* ! Xorriso_pvt_misc_includeD */
|
||||
|
||||
|
@ -625,14 +625,9 @@ treatment_patch:;
|
||||
return(ret);
|
||||
|
||||
} else if(strncmp(treatpt, "cat_hidden=", 11) == 0) {
|
||||
if(strcmp(treatpt + 11, "on") == 0)
|
||||
xorriso->boot_image_cat_hidden= 1 | 2;
|
||||
else if(strcmp(treatpt + 11, "iso_rr") == 0)
|
||||
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;
|
||||
ret= Xorriso__hide_mode(treatpt + 11, 0);
|
||||
if(ret >= 0)
|
||||
xorriso->boot_image_cat_hidden= ret;
|
||||
else
|
||||
was_ok= 0;
|
||||
|
||||
|
@ -686,6 +686,33 @@ not_enough_arguments:;
|
||||
Findjob_set_filter_filter(job, -1, 0);
|
||||
} else if(strcmp(argv[i], "-has_md5")==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) {
|
||||
ret= Findjob_set_false(job, -1, 0);
|
||||
} else if(strcmp(argv[i], "-false") == 0) {
|
||||
@ -937,6 +964,17 @@ not_enough_exec_arguments:;
|
||||
i+= 1;
|
||||
sscanf(argv[i], "%d", &type);
|
||||
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 {
|
||||
sprintf(xorriso->info_text, "-find -exec: unknown action %s",
|
||||
Text_shellsafe(argv[i], sfe, 0));
|
||||
|
@ -1488,6 +1488,11 @@ Matches data files which have MD5 checksums.
|
||||
\fB\-has_filter\fR :
|
||||
Matches files which are filtered by -set_filter.
|
||||
.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 :
|
||||
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.
|
||||
@ -1662,6 +1667,13 @@ E.g.: -exec sort_weight 3 --
|
||||
\fBshow_stream\fR
|
||||
shows the content stream chain of a data file.
|
||||
.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
|
||||
performs another run of -find on the matching file address.
|
||||
It accepts the same params as -find, except iso_rr_path.
|
||||
|
@ -1356,6 +1356,10 @@ File: xorriso.info, Node: CmdFind, Next: Filter, Prev: Manip, Up: Options
|
||||
Matches data files which have MD5 checksums.
|
||||
-has_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 :
|
||||
If this test is reached and the tested file is a directory
|
||||
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 --
|
||||
show_stream
|
||||
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
|
||||
performs another run of -find on the matching file address.
|
||||
It accepts the same params as -find, except iso_rr_path.
|
||||
@ -4075,41 +4084,41 @@ Node: Insert39576
|
||||
Node: SetInsert47933
|
||||
Node: Manip56500
|
||||
Node: CmdFind64376
|
||||
Node: Filter73912
|
||||
Node: Writing78261
|
||||
Node: SetWrite84550
|
||||
Node: Bootable94834
|
||||
Node: Charset102786
|
||||
Node: Exception105540
|
||||
Node: DialogCtl110055
|
||||
Node: Inquiry112400
|
||||
Node: Navigate116540
|
||||
Node: Verify123894
|
||||
Node: Restore132314
|
||||
Node: Emulation138970
|
||||
Node: Scripting145843
|
||||
Node: Frontend151405
|
||||
Node: Examples152606
|
||||
Node: ExDevices153775
|
||||
Node: ExCreate154409
|
||||
Node: ExDialog155683
|
||||
Node: ExGrowing156945
|
||||
Node: ExModifying157747
|
||||
Node: ExBootable158248
|
||||
Node: ExCharset158795
|
||||
Node: ExPseudo159623
|
||||
Node: ExCdrecord160517
|
||||
Node: ExMkisofs160832
|
||||
Node: ExGrowisofs161835
|
||||
Node: ExException162959
|
||||
Node: ExTime163413
|
||||
Node: ExIncBackup163872
|
||||
Node: ExRestore167344
|
||||
Node: ExRecovery168313
|
||||
Node: Files168879
|
||||
Node: Seealso169917
|
||||
Node: Legal170441
|
||||
Node: CommandIdx171363
|
||||
Node: ConceptIdx184664
|
||||
Node: Filter74319
|
||||
Node: Writing78668
|
||||
Node: SetWrite84957
|
||||
Node: Bootable95241
|
||||
Node: Charset103193
|
||||
Node: Exception105947
|
||||
Node: DialogCtl110462
|
||||
Node: Inquiry112807
|
||||
Node: Navigate116947
|
||||
Node: Verify124301
|
||||
Node: Restore132721
|
||||
Node: Emulation139377
|
||||
Node: Scripting146250
|
||||
Node: Frontend151812
|
||||
Node: Examples153013
|
||||
Node: ExDevices154182
|
||||
Node: ExCreate154816
|
||||
Node: ExDialog156090
|
||||
Node: ExGrowing157352
|
||||
Node: ExModifying158154
|
||||
Node: ExBootable158655
|
||||
Node: ExCharset159202
|
||||
Node: ExPseudo160030
|
||||
Node: ExCdrecord160924
|
||||
Node: ExMkisofs161239
|
||||
Node: ExGrowisofs162242
|
||||
Node: ExException163366
|
||||
Node: ExTime163820
|
||||
Node: ExIncBackup164279
|
||||
Node: ExRestore167751
|
||||
Node: ExRecovery168720
|
||||
Node: Files169286
|
||||
Node: Seealso170324
|
||||
Node: Legal170848
|
||||
Node: CommandIdx171770
|
||||
Node: ConceptIdx185071
|
||||
|
||||
End Tag Table
|
||||
|
@ -1830,6 +1830,11 @@ Matches data files which have MD5 checksums.
|
||||
@item -has_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 :
|
||||
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.
|
||||
@ -2022,6 +2027,13 @@ E.g.: -exec sort_weight 3 @minus{}@minus{}
|
||||
@item show_stream
|
||||
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
|
||||
performs another run of -find on the matching file address.
|
||||
It accepts the same params as -find, except iso_rr_path.
|
||||
|
@ -1 +1 @@
|
||||
#define Xorriso_timestamP "2010.06.19.152046"
|
||||
#define Xorriso_timestamP "2010.06.20.072130"
|
||||
|
Loading…
Reference in New Issue
Block a user