New -find test -disk_path
This commit is contained in:
@ -667,15 +667,17 @@ ex:;
|
||||
bit2= do not count deleted files with rm and rm_r
|
||||
bit3= use Xorriso_findi_sorted() rather than Xorriso_findi()
|
||||
(this can also be ordered by test -sort_lba)
|
||||
bit4= return number of matches plus 1
|
||||
*/
|
||||
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;
|
||||
int list_extattr_head= 0, bsl_mem, disk_path;
|
||||
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;
|
||||
char *arg1_pt;
|
||||
|
||||
struct stat dir_stbuf;
|
||||
uid_t user= 0;
|
||||
@ -769,14 +771,25 @@ 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) {
|
||||
} else if(strcmp(argv[i], "-disk_name")==0 ||
|
||||
strcmp(argv[i], "-disk_path")==0) {
|
||||
disk_path= (strcmp(argv[i], "-disk_path") == 0);
|
||||
if(i+1>=end_idx)
|
||||
goto not_enough_arguments;
|
||||
i++;
|
||||
ret= Findjob_set_name_expr(job, argv[i], 2);
|
||||
arg1_pt= argv[i];
|
||||
if(disk_path) {
|
||||
ret= Xorriso_make_abs_adr(xorriso, xorriso->wdx, argv[i], path,
|
||||
1 | 2 | 4 | 8);
|
||||
if(ret<=0)
|
||||
goto ex;
|
||||
arg1_pt= path;
|
||||
}
|
||||
ret= Findjob_set_name_expr(job, arg1_pt, 2 + disk_path);
|
||||
if(ret<=0) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-find[ix]: cannot set -disk_name expression ");
|
||||
"-find[ix]: cannot set %s ",
|
||||
disk_path ? "-disk_path address" : "-disk_name expression");
|
||||
Text_shellsafe(argv[i], xorriso->info_text, 1);
|
||||
goto sorry_ex;
|
||||
}
|
||||
@ -1200,6 +1213,8 @@ ex:;
|
||||
free(access_acl_text);
|
||||
if(default_acl_text != NULL)
|
||||
free(default_acl_text);
|
||||
if(ret > 0 && (flag & 16) && first_job != NULL)
|
||||
ret= first_job->match_count + 1;
|
||||
Findjob_destroy(&first_job, 0);
|
||||
Xorriso_free_meM(path);
|
||||
Xorriso_free_meM(other_path_start);
|
||||
|
Reference in New Issue
Block a user