New -find test -bad_outname, new -find action print_outname

This commit is contained in:
2013-12-29 12:02:10 +00:00
parent a924b5cec0
commit 5483ac27f6
10 changed files with 514 additions and 240 deletions

View File

@ -660,6 +660,23 @@ ex:;
}
static int Xorriso_determine_name_space(struct XorrisO *xorriso,
char *space_name, int flag)
{
if(strcmp(space_name, "rockridge") == 0)
return(1);
else if(strcmp(space_name, "joliet") == 0)
return(2);
else if(strcmp(space_name, "ecma119") == 0 ||
strcmp(space_name, "iso9660") == 0)
return(3);
else if(strcmp(space_name, "hfsplus") == 0)
return(4);
sprintf(xorriso->info_text, "-find: Unknown output namespace identifier");
return(0);
}
/* Option -find alias -findi, and -findx */
/* @param flag bit0= -findx rather than -findi
bit1= do not reset pacifier, no final pacifier message
@ -673,7 +690,7 @@ int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int ret, i, end_idx, type= 0, action, deleter= 0, start_lba, count;
int list_extattr_head= 0, bsl_mem, disk_path;
int list_extattr_head= 0, bsl_mem, disk_path, name_space;
struct FindjoB *job, *first_job= NULL, *new_job;
char *start_path, *path= NULL, *cpt, *other_path_start= NULL, *cd_pt;
char *access_acl_text= NULL, *default_acl_text= NULL, *list_extattr_mode;
@ -831,6 +848,19 @@ not_enough_arguments:;
sprintf(xorriso->info_text, "-findi: cannot setup -has_hfs_bless test");
goto sorry_ex;
}
} else if(strcmp(argv[i], "-bad_outname")==0) {
if(i + 1 >= end_idx)
goto not_enough_arguments;
i+= 1;
name_space= Xorriso_determine_name_space(xorriso, argv[i], 0);
if(name_space < 0) {
ret= 0; goto sorry_ex;
}
ret= Findjob_set_num_filter(job, 21, name_space, 0, 0);
if(ret <= 0) {
sprintf(xorriso->info_text, "-findi: cannot setup -bad_outname 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) {
@ -1139,6 +1169,16 @@ not_enough_exec_arguments:;
Findjob_set_action_target(job, 47, argv[i], 0);
} else if(strcmp(cpt, "get_hfs_bless")==0) {
Findjob_set_action_target(job, 48, NULL, 0);
} else if(strcmp(cpt, "print_outname")==0) {
if(i+1>=end_idx)
goto not_enough_exec_arguments;
i++;
name_space= Xorriso_determine_name_space(xorriso, argv[i], 0);
if(name_space < 0) {
ret= 0; goto sorry_ex;
}
Findjob_set_action_type(job, 50, name_space, 0);
} else {
sprintf(xorriso->info_text, "-find -exec: unknown action ");
Text_shellsafe(argv[i], xorriso->info_text, 1);
@ -1802,7 +1842,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -type b|c|d|p|f|l|s|e, -pending_data, -hidden,",
" -lba_range start count, -damaged, -has_acl, -has_xattr,",
" -has_aaip, -has_filter, -has_md5, -has_any_xattr,",
" -has_hfs_crtp, -has_hfs_bless,",
" -has_hfs_crtp, -has_hfs_bless, -bad_outname,",
" -prune, -decision yes|no, -true, -false",
" Operators: -not, -or, -and, -sub, (, -subend, ),",
" -if, -then, -elseif, -else, -endif",
@ -1812,7 +1852,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" getfacl, setfacl, getfattr, setfattr, get_any_xattr,",
" list_extattr, get_md5, check_md5, make_md5,",
" set_hfs_crtp, get_hfs_crtp, set_hfs_bless, get_hfs_bless,",
" set_filter, show_stream, mkisofs_r, hide, find.",
" set_filter, show_stream, mkisofs_r, hide, print_outname,",
" estimate_size, find",
" params are their parameters except iso_rr_path.",
" -mkdir iso_rr_path [...]",
" Create empty directories if they do not exist yet.",