New -find actions "rm" and "rm_r", silenced comparison results with -update*
This commit is contained in:
@ -2372,14 +2372,22 @@ struct FindjoB {
|
||||
regmatch_t name_match;
|
||||
#endif
|
||||
|
||||
/* b = blockdev, c = chardev, d = directory, p = fifo, f = reg , - = reg,
|
||||
s = socket, X = other , 0x0 = test inactive
|
||||
/* b = blockdev
|
||||
c = chardev
|
||||
d = directory
|
||||
p = fifo
|
||||
f = reg
|
||||
- = reg
|
||||
s = socket
|
||||
>>> m = subordinate mountpoint (does never match find start directory)
|
||||
X = other
|
||||
0x0 = test inactive
|
||||
*/
|
||||
char file_type;
|
||||
|
||||
|
||||
/* 0= echo
|
||||
>>> 1= rm
|
||||
>>> 1= rm (also rmdir)
|
||||
>>> 2= rm_r
|
||||
>>> 3= mv target
|
||||
4= chown user
|
||||
@ -3290,6 +3298,7 @@ int Xorriso_pacifier_reset(struct XorrisO *xorriso, int flag)
|
||||
@param current_object A string telling the object currently processed.
|
||||
Ignored if "".
|
||||
@param flag bit0= report unconditionally, no time check
|
||||
bit1= report count <=0 (no thank you for being patient then)
|
||||
*/
|
||||
int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done,
|
||||
off_t count, off_t todo, char *current_object,
|
||||
@ -3305,7 +3314,7 @@ int Xorriso_pacifier_callback(struct XorrisO *xorriso, char *what_done,
|
||||
since= current_time - xorriso->start_time;
|
||||
if((flag&1)&&since<1.0)
|
||||
since= 1.0;
|
||||
if(count<=0.0) {
|
||||
if(count<=0.0 && !(flag&2)) {
|
||||
sprintf(xorriso->info_text,
|
||||
"Thank you for being patient since %.f seconds", since);
|
||||
} else if(todo<=0.0) {
|
||||
@ -4510,7 +4519,7 @@ int Xorriso_find_compare(struct XorrisO *xorriso, void *boss_iter,
|
||||
follow_links= (xorriso->do_follow_links ||
|
||||
(xorriso->do_follow_param && !(flag&2))) <<28;
|
||||
ret= Xorriso_compare_2_files(xorriso, disk_path, iso_path, adrc, &result,
|
||||
2|follow_links|(1<<29));
|
||||
2|follow_links|(1<<29)|((flag&1)<<31));
|
||||
if(ret<xorriso->find_compare_result)
|
||||
xorriso->find_compare_result= ret;
|
||||
if(flag&1) {
|
||||
@ -6147,7 +6156,7 @@ int Xorriso_findx_action(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
ret= 1;
|
||||
} else if(action==18) { /* add_missing */
|
||||
ret= Xorriso_compare_2_files(xorriso, abs_path, iso_path, abs_path+dpl,
|
||||
&compare_result, 4);
|
||||
&compare_result, 4|(1<<31));
|
||||
if(ret<xorriso->find_compare_result)
|
||||
xorriso->find_compare_result= ret;
|
||||
if(ret==0) {
|
||||
@ -6226,17 +6235,12 @@ int Xorriso_findx(struct XorrisO *xorriso, struct FindjoB *job,
|
||||
if(ret<0)
|
||||
goto ex;
|
||||
if(ret>0) {
|
||||
#ifdef NIX
|
||||
sprintf(xorriso->result_line, "%s\n", Text_shellsafe(dir_path, sfe, 0));
|
||||
Xorriso_result(xorriso, 0);
|
||||
#else
|
||||
ret= Xorriso_findx_action(xorriso, job, abs_dir_path, dir_path, depth,
|
||||
flag&1);
|
||||
if(ret<=0) {
|
||||
if(Xorriso_eval_problem_status(xorriso, ret, 1|2)<0)
|
||||
goto ex;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
if(!S_ISDIR(dir_stbuf->st_mode))
|
||||
@ -7137,7 +7141,7 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
|
||||
ret= 1;
|
||||
if(ret>0 && xorriso->info_text[0]) {
|
||||
strcat(xorriso->info_text, Text_shellsafe(iso_rr_path, sfe, 0));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 1);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "UPDATE", 0);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
@ -8374,11 +8378,12 @@ sorry_ex:
|
||||
/* @param flag bit0= -findx rather than -findi
|
||||
bit1= do not reset pacifier, no final pacifier message
|
||||
do not reset find_compare_result
|
||||
bit2= do not count deleted files with rm and rm_r
|
||||
*/
|
||||
int Xorriso_option_find(struct XorrisO *xorriso, int argc, char **argv,
|
||||
int *idx, int flag)
|
||||
{
|
||||
int ret, i, end_idx, type= 0, action;
|
||||
int ret, i, end_idx, type= 0, action, deleter= 0;
|
||||
struct FindjoB *job, *first_job= NULL, *new_job;
|
||||
char *start_path, sfe[5*SfileadrL], *cpt, other_path_start[SfileadrL];
|
||||
struct stat dir_stbuf;
|
||||
@ -8425,13 +8430,15 @@ not_enough_arguments:;
|
||||
cpt++;
|
||||
if(strcmp(cpt, "echo")==0) {
|
||||
Findjob_set_action_target(job, 0, NULL, 0);
|
||||
} else if(strcmp(cpt, "rm")==0) {
|
||||
Findjob_set_action_target(job, 1, NULL, 0);
|
||||
deleter= 1;
|
||||
} else if(strcmp(cpt, "rm_r")==0) {
|
||||
Findjob_set_action_target(job, 2, NULL, 0);
|
||||
deleter= 1;
|
||||
|
||||
#ifdef NIX
|
||||
/* >>> not implemented yet */;
|
||||
} else if(strcmp(cpt, "rm")==0) {
|
||||
Findjob_set_action_target(job, 1, NULL, 0);
|
||||
} else if(strcmp(cpt, "rm_r")==0) {
|
||||
Findjob_set_action_target(job, 2, NULL, 0);
|
||||
} else if(strcmp(cpt, "mv")==0) {
|
||||
if(i+1>=end_idx)
|
||||
goto not_enough_arguments;
|
||||
@ -8570,9 +8577,12 @@ sorry_ex:;
|
||||
0);
|
||||
else
|
||||
ret= Xorriso_findi(xorriso, first_job, NULL, (off_t) 0, NULL,
|
||||
start_path, &dir_stbuf, 0, 0);
|
||||
start_path, &dir_stbuf, 0, (flag&4)>>1);
|
||||
ex:;
|
||||
if(mem_lut!=xorriso->last_update_time && mem_lut!=0.0 && !(flag&2))
|
||||
if(deleter && !(flag&2))
|
||||
Xorriso_pacifier_callback(xorriso, "iso_rr_paths deleted",
|
||||
xorriso->pacifier_count, 0, "", 1|2);
|
||||
else if(mem_lut!=xorriso->last_update_time && mem_lut!=0.0 && !(flag&2))
|
||||
Xorriso_pacifier_callback(xorriso, "content bytes read",
|
||||
xorriso->pacifier_count, 0, "", 1);
|
||||
Findjob_destroy(&first_job, 0);
|
||||
@ -10050,7 +10060,7 @@ int Xorriso_option_update(struct XorrisO *xorriso, char *disk_path,
|
||||
/* compare ctime too, no filename reporting, eventually silent */
|
||||
follow_links= (xorriso->do_follow_links || xorriso->do_follow_param) <<28;
|
||||
ret= Xorriso_compare_2_files(xorriso, disk_path, ipth, "", &result,
|
||||
2 | follow_links | ((flag&4)<<27) | (1<<30));
|
||||
2 | follow_links | ((flag&4)<<27) | (3<<30));
|
||||
if(ret==0) {
|
||||
uret= Xorriso_update_interpreter(xorriso, NULL, result, disk_path, ipth,
|
||||
0);
|
||||
|
Reference in New Issue
Block a user