New pseudo test with -find : -sort_lba which is actually an option
This commit is contained in:
@ -2898,12 +2898,17 @@ int Findjob_new_node(struct FindjoB *job, struct ExprnodE **fnode,
|
||||
}
|
||||
|
||||
|
||||
/* If an operator is expected : use -and */
|
||||
/* If an operator is expected : use -and
|
||||
@param flag bit0= prepare for a pseudo-test:
|
||||
if an operator is expected, do nothing and return 2
|
||||
*/
|
||||
int Findjob_default_and(struct FindjoB *o, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(Findjob_cursor_complete(o, 0)) {
|
||||
if(flag & 1)
|
||||
return(2);
|
||||
ret= Findjob_and(o, 0);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
@ -3212,6 +3217,8 @@ int Findjob_set_file_type(struct FindjoB *o, char file_type, int flag)
|
||||
|
||||
|
||||
/* @param value -1= only without property, 1= only with property
|
||||
@param flag bit0= pseudo-test:
|
||||
if no operator is open, do nothing and return 2
|
||||
*/
|
||||
int Findjob_set_prop_filter(struct FindjoB *o, int test_type, int value,
|
||||
int flag)
|
||||
@ -3219,8 +3226,8 @@ int Findjob_set_prop_filter(struct FindjoB *o, int test_type, int value,
|
||||
struct ExprtesT *t;
|
||||
int ret;
|
||||
|
||||
ret= Findjob_default_and(o, 0);
|
||||
if(ret <= 0)
|
||||
ret= Findjob_default_and(o, flag & 1);
|
||||
if(ret <= 0 || ret == 2)
|
||||
return(ret);
|
||||
|
||||
t= o->cursor->test;
|
||||
@ -3359,12 +3366,14 @@ int Findjob_set_decision(struct FindjoB *o, char *decision, int flag)
|
||||
|
||||
|
||||
/* @param value -1= true, 1= false
|
||||
@param flag bit0= pseudo-test:
|
||||
if no operator is open, do nothing and return 2
|
||||
*/
|
||||
int Findjob_set_false(struct FindjoB *o, int value, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret= Findjob_set_prop_filter(o, 0, value, 0);
|
||||
ret= Findjob_set_prop_filter(o, 0, value, flag & 1);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -14765,6 +14774,7 @@ ex:;
|
||||
do not reset find_compare_result
|
||||
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)
|
||||
*/
|
||||
int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
|
||||
int *idx, int flag)
|
||||
@ -14905,6 +14915,12 @@ not_enough_arguments:;
|
||||
|
||||
#endif /* Xorriso_findjob_on_expR */
|
||||
|
||||
} else if(strcmp(argv[i], "-sort_lba") == 0) {
|
||||
flag|= 8;
|
||||
/* If an operator is open: insert a -true test, else do nothing */
|
||||
ret= Findjob_set_false(job, -1, 1);
|
||||
if(ret == 2)
|
||||
ret= 1;
|
||||
} else if(strcmp(argv[i], "-exec")==0) {
|
||||
if(i+1>=end_idx) {
|
||||
not_enough_exec_arguments:;
|
||||
@ -15103,7 +15119,7 @@ sorry_ex:;
|
||||
0);
|
||||
else if(flag & 8) {
|
||||
cpt= start_path;
|
||||
ret= Xorriso_findi_sorted(xorriso, first_job, 1, &cpt, 0);
|
||||
ret= Xorriso_findi_sorted(xorriso, first_job, (off_t) 0, 1, &cpt, 0);
|
||||
} else
|
||||
ret= Xorriso_findi(xorriso, first_job, NULL, (off_t) 0, NULL,
|
||||
start_path, &dir_stbuf, 0, (flag&4)>>1);
|
||||
@ -18855,9 +18871,6 @@ next_command:;
|
||||
} else if(strcmp(cmd,"find")==0 || strcmp(cmd,"findi")==0) {
|
||||
ret= Xorriso_option_find(xorriso, argc, argv, idx, 0);
|
||||
|
||||
} else if(strcmp(cmd,"find_sorted")==0) {
|
||||
ret= Xorriso_option_find(xorriso, argc, argv, idx, 8);
|
||||
|
||||
} else if(strcmp(cmd,"findx")==0) {
|
||||
ret= Xorriso_option_find(xorriso, argc, argv, idx, 1);
|
||||
|
||||
|
Reference in New Issue
Block a user