Gave problem handling finer granularity within loops

This commit is contained in:
Thomas Schmitt 2007-11-11 11:21:46 +00:00
parent f02c8c7ba8
commit a59c10dfec
4 changed files with 218 additions and 126 deletions

View File

@ -2422,6 +2422,7 @@ int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag)
bit1= mark '@' and '@@' by return 4
bit2= accept: i|n= ignore | do not remove , r|y= retry | remove , q|x= abort
bit3= @@@ = 'done reading' rather than 'abort'
bit4= in non-dialog mode return 6 rather than 1
*/
/* return: <=0 error
1= go on | do not remove existing file
@ -2436,6 +2437,11 @@ int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag)
char line[SfileadrL],*cpt,previous_line[SfileadrL];
char *abort_req_text,*abort_really_text;
if(!xorriso->dialog) {
if(flag&16)
return(6);
return(1);
}
if(flag&8) {
abort_req_text= "request to end";
abort_really_text= "done reading";
@ -2457,7 +2463,7 @@ int Xorriso_request_confirmation(struct XorrisO *xorriso, int flag)
if(flag&1) {
strcpy(previous_line,cpt);
sprintf(xorriso->info_text,
".... [%s = %s registered. Really %s ? (y/n) ] ....\n",
"... [%s = %s registered. Really %s ? (y/n) ] ...\n",
cpt,abort_req_text,abort_really_text);
Xorriso_info(xorriso,0);
ret= Xorriso_dialog_input(xorriso,line,sizeof(line),1);
@ -3201,13 +3207,8 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= 0;
if(xorriso->use_stdin)
sprintf(line,"-use_stdin\n");
else {
sprintf(line,"-use_readline\n");
is_default= 1;
}
is_default= (xorriso->use_stdin==0);
sprintf(line,"-use_readline %s\n", (xorriso->use_stdin?"off":"on"));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
@ -3683,13 +3684,26 @@ int Xorriso_msgs_submit(struct XorrisO *xorriso,
}
/**
@param flag bit0= do not issue own event messages
bit1= take xorriso->request_to_abort as reason for abort
@return Gives the advice:
2= pardon was given, go on
1= no problem, go on
0= function failed but xorriso would not abort, go on
<0= do abort
-1 = due to probelm_status
-2 = due to xorriso->request_to_abort
*/
int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag)
{
static int sev= 0;
if(sev==0)
Xorriso__text_to_sev("SORRY", &sev, 0);
if((flag&2) && xorriso->request_to_abort)
return(-2);
Xorriso_process_msg_queues(xorriso, 0);
if(ret>0 && xorriso->problem_status <= 0)
return(1);
@ -3793,7 +3807,7 @@ int Xorriso_option_abort_on(struct XorrisO *xorriso, char *severity, int flag)
int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, end_idx, ret;
int i, end_idx, ret, was_failure= 0, fret;
char target[SfileadrL], source[SfileadrL], *ept, eff_path[SfileadrL];
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 0);
@ -3812,35 +3826,45 @@ int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
if(target[0]!='/') {
ret= Sfile_prepend_path(xorriso->wdi, target, 0);
if(ret<=0)
goto ex;
goto problem_handler;
}
if(source[0]!='/') {
ret= Sfile_prepend_path(xorriso->wdx, source, 0);
if(ret<=0)
goto ex;
goto problem_handler;
}
ret= Xorriso_normalize_img_path(xorriso, target, eff_path, 2);
if(ret<=0)
return(ret);
goto problem_handler;
strcpy(target, eff_path);
ret= Xorriso_normalize_img_path(xorriso, source, eff_path, 2|4);
if(ret<=0)
return(ret);
goto problem_handler;
strcpy(source, eff_path);
ret= Xorriso_graft_in(xorriso, source, target, 0);
if(ret<=0)
goto ex;
if(ret<=0 || xorriso->request_to_abort)
goto problem_handler;
sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n",
(ret>1 ? "directory" : "file"), target, source);
if(!(flag&1))
Xorriso_info(xorriso, 0);
continue; /* regular bottom of loop */
problem_handler:;
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
ret= 1;
ex:;
(*idx)= end_idx;
return(ret);
if(ret<=0)
return(ret);
return(!was_failure);
}
@ -3849,7 +3873,7 @@ int Xorriso_option_alter_date(struct XorrisO *xorriso,
char *time_type, char *timestring,
int argc, char **argv, int *idx, int flag)
{
int i, ret, was_failure= 0, t_type= 0, end_idx;
int i, ret, was_failure= 0, t_type= 0, end_idx, fret;
time_t t;
int optc= 0;
char **optv= NULL;
@ -3882,10 +3906,13 @@ int Xorriso_option_alter_date(struct XorrisO *xorriso,
goto ex;
for(i= 0; i<optc; i++) {
ret= Xorriso_set_time(xorriso, optv[i], t, t_type);
if(ret<0)
goto ex;
if(ret==0)
was_failure= 1;
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
ret= 1;
ex:;
@ -4089,7 +4116,7 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid,
int argc, char **argv, int *idx, int flag)
{
int i, ret, was_failure= 0, end_idx;
int i, ret, was_failure= 0, end_idx, fret;
gid_t gid_number;
int optc= 0;
char **optv= NULL;
@ -4102,10 +4129,13 @@ int Xorriso_option_chgrpi(struct XorrisO *xorriso, char *gid,
goto ex;
for(i= 0; i<optc; i++) {
ret= Xorriso_set_gid(xorriso, optv[i], gid_number, 0);
if(ret<0)
goto ex;
if(ret==0)
was_failure= 1;
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
ret= 1;
ex:;
@ -4121,7 +4151,7 @@ ex:;
int Xorriso_option_chmodi(struct XorrisO *xorriso, char *mode,
int argc, char **argv, int *idx, int flag)
{
int i, ret, who_val= 0, was_failure= 0, end_idx;
int i, ret, who_val= 0, was_failure= 0, end_idx, fret;
unsigned int num;
mode_t mode_and= ~0, mode_or= 0, mode_val, mask;
char sfe[5*SfileadrL], *mpt, *opt, *vpt;
@ -4219,10 +4249,13 @@ unrecognizable:;
goto ex;
for(i= 0; i<optc; i++) {
ret= Xorriso_set_st_mode(xorriso, optv[i], mode_and, mode_or, 0);
if(ret<0)
break;
if(ret==0)
was_failure= 1;
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
ret= 1;
ex:;
@ -4238,7 +4271,7 @@ ex:;
int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid,
int argc, char **argv, int *idx, int flag)
{
int i, ret, was_failure= 0, end_idx;
int i, ret, was_failure= 0, end_idx, fret;
uid_t uid_number;
int optc= 0;
char **optv= NULL;
@ -4251,10 +4284,13 @@ int Xorriso_option_chowni(struct XorrisO *xorriso, char *uid,
goto ex;
for(i= 0; i<optc; i++) {
ret= Xorriso_set_uid(xorriso, optv[i], uid_number, 0);
if(ret<0)
goto ex;
if(ret==0)
was_failure= 1;
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
ret= 0; goto ex;
}
ret= 1;
ex:;
@ -4999,21 +5035,26 @@ int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag)
int Xorriso_option_mkdiri(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, end_idx, ret, was_failure= 0;
int i, end_idx, ret, was_failure= 0, fret;
end_idx= Xorriso_end_idx(xorriso, argc, argv, *idx, 0);
for(i= *idx; i<end_idx; i++) {
ret= Xorriso_mkdir(xorriso, argv[i], 0);
if(ret<0)
{ret= 0; goto ex;}
if(ret==0)
was_failure= 1;
if(ret>0 && !xorriso->request_to_abort)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
ret= 1;
ex:;
(*idx)= end_idx;
return(ret>0 && !was_failure);
if(ret<=0)
return(ret);
return(!was_failure);
}
@ -5021,7 +5062,7 @@ ex:;
int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, end_idx, ret, is_dir= 0, was_failure= 0;
int i, end_idx, ret, is_dir= 0, was_failure= 0, fret;
char sfe[5*SfileadrL], sfe2[5*SfileadrL];
char eff_origin[SfileadrL], eff_dest[SfileadrL];
char dest_dir[SfileadrL], *leafname;
@ -5036,10 +5077,6 @@ int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv,
{ret= 0; goto ex;}
}
#ifdef NIX
optc= end_idx - *idx;
optv= argv + *idx;
#else
ret= Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv,
16); /* ignore last argument */
if(ret<=0)
@ -5048,14 +5085,17 @@ int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv,
32|64); /* demand one match, or 0 with a constant */
if(ret<=0)
goto ex;
#endif /* ! NIX */
#ifdef NIX
/* <<< */
/* Check existence of old addresses */
for(i= 0; i<optc; i++) {
ret= Xorriso_normalize_img_path(xorriso, optv[i], eff_origin, 0);
if(ret<=0)
{ret= 0; goto ex;}
}
#endif /* NIX */
/* Evaluate target address */
ret= Xorriso_normalize_img_path(xorriso, destv[0], eff_dest, 1);
if(ret<0)
@ -5078,8 +5118,8 @@ int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv,
/* Perform movements */
for(i= 0; i<optc; i++) {
ret= Xorriso_normalize_img_path(xorriso, optv[i], eff_origin, 0);
if(ret<=0)
{ret= 0; goto ex;}
if(ret<=0 || xorriso->request_to_abort)
goto problem_handler;
if(is_dir) {
leafname= strrchr(eff_origin, '/');
if(leafname==NULL)
@ -5092,19 +5132,23 @@ int Xorriso_option_mvi(struct XorrisO *xorriso, int argc, char **argv,
printf(xorriso->info_text, "Effective path gets much too long (%d)",
strlen(eff_dest)+strlen(leafname)+1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
{ret= 0; goto ex;}
goto problem_handler;
}
}
ret= Xorriso_rename(xorriso, eff_origin, eff_dest, 0);
if(ret<0)
goto ex;
if(ret==0)
was_failure= 1;
else {
sprintf(xorriso->info_text, "Renamed in ISO image: %s to %s\n",
Text_shellsafe(eff_origin,sfe,0),Text_shellsafe(eff_dest,sfe2,0));
Xorriso_info(xorriso, 0);
}
if(ret<=0 || xorriso->request_to_abort)
goto problem_handler;
sprintf(xorriso->info_text, "Renamed in ISO image: %s to %s\n",
Text_shellsafe(eff_origin,sfe,0),Text_shellsafe(eff_dest,sfe2,0));
Xorriso_info(xorriso, 0);
continue; /* regular bottom of loop */
problem_handler:;
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
ret= !was_failure;
ex:;
@ -5135,7 +5179,7 @@ return:
<=0 error , 1 = success , 3 = end program run
*/
{
int ret,linecount= 0, argc;
int ret,linecount= 0, argc, was_failure= 0, fret;
FILE *fp= NULL;
char line[5*SfileadrL], shellsafe[5*SfileadrL];
char **argv= NULL;
@ -5168,22 +5212,32 @@ return:
if(flag&1) {
ret= Sfile_make_argv(xorriso->progname, line, &argc, &argv, 4|8);
if(ret<=0)
goto ex;
goto problem_handler;
ret= Xorriso_prescan_args(xorriso,argc,argv,1);
Sfile_make_argv("", "", &argc, &argv, 2); /* release memory */
if(ret==0)
{ret= 3; goto ex;}
if(ret<0)
goto ex;
goto problem_handler;
} else {
if(xorriso->is_dialog) {
sprintf(xorriso->info_text,"+ %d: %s\n",linecount,line);
Xorriso_info(xorriso,1);
}
ret= Xorriso_execute_option(xorriso,line,1|(1<<16));
if(ret<=0 || ret==3)
if(ret==3)
goto ex;
if(ret<=0)
goto problem_handler;
}
continue; /* regular bottom of loop */
problem_handler:;
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1);
if(fret>=0)
continue;
goto ex;
}
ex:;
Xorriso_reset_counters(xorriso,1);
@ -5195,7 +5249,9 @@ ex:;
linecount,shellsafe);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 1);
}
return(ret);
if(ret!=1)
return(ret);
return(!was_failure);
}
@ -5205,7 +5261,7 @@ int Xorriso_option_overwrite(struct XorrisO *xorriso, char *mode, int flag)
if(strcmp(mode, "off")==0)
xorriso->do_overwrite= 0;
else if(strcmp(mode, "on")==0)
xorriso->do_overwrite= 0;
xorriso->do_overwrite= 1;
else if(strcmp(mode, "nondir")==0)
xorriso->do_overwrite= 2;
else {
@ -5236,7 +5292,7 @@ int Xorriso_option_page(struct XorrisO *xorriso, int len, int width, int flag)
/* Option -path-list */
int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
{
int ret,linecount= 0, insertcount= 0, null= 0;
int ret,linecount= 0, insertcount= 0, null= 0, was_failure= 0, fret= 0;
FILE *fp= NULL;
char *argpt, sfe[5*SfileadrL],line[SfileadrL];
@ -5261,21 +5317,32 @@ int Xorriso_option_path_list(struct XorrisO *xorriso, char *adr, int flag)
argpt= line;
null= 0;
ret= Xorriso_option_add(xorriso, 1, &argpt, &null, 1);
if(ret<=0)
goto ex;
if(ret<=0 || xorriso->request_to_abort)
goto problem_handler;
insertcount++;
continue; /* regular bottom of loop */
problem_handler:;
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
ret= 1;
ex:;
if(ret<=0) {
sprintf(xorriso->info_text, "Aborted reading of file %s in line number %d",
Text_shellsafe(adr, sfe, 0), linecount);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0,
(fret==-2 ? "NOTE" : "SORRY"), 0);
}
sprintf(xorriso->info_text, "Added %d items from file %s\n",
insertcount, Text_shellsafe(adr, sfe, 0));
Xorriso_info(xorriso,0);
return(ret);
if(ret<=0)
return(ret);
return(!was_failure);
}
@ -5436,7 +5503,7 @@ int Xorriso_option_report_about(struct XorrisO *xorriso, char *severity,
int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv,
int *idx, int flag)
{
int i, ret, end_idx;
int i, ret, end_idx, was_failure= 0, fret;
char path[SfileadrL], eff_path[SfileadrL];
int optc= 0;
char **optv= NULL;
@ -5446,31 +5513,41 @@ int Xorriso_option_rmi(struct XorrisO *xorriso, int argc, char **argv,
goto ex;
for(i= 0; i<optc; i++) {
if(Sfile_str(path,optv[i],0)<=0)
{ret= -1; goto ex;}
{ret= -1; goto problem_handler;}
if(path[0]!='/') {
ret= Sfile_prepend_path(xorriso->wdi, path, 0);
if(ret<=0)
goto ex;
goto problem_handler;
}
ret= Xorriso_normalize_img_path(xorriso, path, eff_path, 2);
if(ret<=0)
return(ret);
goto problem_handler;
strcpy(path, eff_path);
ret= Xorriso_rmi(xorriso, NULL, path, flag&(1|2));
if(ret<=0)
goto ex;
if(ret<=0 || xorriso->request_to_abort)
goto problem_handler;
if(ret<3) {
sprintf(xorriso->info_text, "Removed from ISO image: %s '%s'\n",
((flag&2) ? "directory" : (ret>1 ? "subtree" : "file")), path);
Xorriso_info(xorriso, 0);
}
continue; /* regular bottom of loop */
problem_handler:;
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
ret= 1;
ex:;
(*idx)= end_idx;
Xorriso_opt_args(xorriso, argc, argv, *idx, &end_idx, &optc, &optv, 256);
return(ret);
if(ret<=0)
return(ret);
return(!was_failure);
}
@ -6207,7 +6284,7 @@ int Xorriso_prescan_args(struct XorrisO *xorriso, int argc, char **argv,
/** Load content startup files into preskin cache */
int Xorriso_read_rc(struct XorrisO *xorriso, int flag)
{
int ret,i;
int ret,i,was_failure= 0,fret;
i= xorriso->rc_filename_count-1;
Sfile_home_adr_s(".xorrisorc", xorriso->rc_filenames[i],
@ -6217,10 +6294,17 @@ int Xorriso_read_rc(struct XorrisO *xorriso, int flag)
if(ret!=1)
continue;
ret= Xorriso_option_options_from_file(xorriso,xorriso->rc_filenames[i],0);
if(ret!=1)
if(ret>1)
return(ret);
if(ret==1)
continue; /* regular bottom of loop */
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1);
if(fret>=0)
continue;
return(ret);
}
return(1);
return(!was_failure);
}

View File

@ -58,11 +58,15 @@ int Xorriso_msgs_submit(struct XorrisO *xorriso,
@param xorriso The environment handle
@param ret The return value of the prviously called option function
@param flag bit0= do not issue own event messages
bit1= take xorriso->request_to_abort as reason for abort
@return Gives the advice:
2= pardon was given, go on
1= no problem, go on
0= function failed but xorriso would not abort, go on
<0= do abort
-1 = due to xorriso->problem_status
or due to ret<0
-2 = due to xorriso->request_to_abort
*/
int Xorriso_eval_problem_status(struct XorrisO *xorriso, int ret, int flag);

View File

@ -1 +1 @@
#define Xorriso_timestamP "2007.11.09.193142"
#define Xorriso_timestamP "2007.11.11.112321"

View File

@ -494,6 +494,7 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
return(ret);
}
apt= npt= path;
if(img_path[0]!='/') {
if(flag&4)
strcpy(path, xorriso->wdx);
@ -505,7 +506,6 @@ int Xorriso_normalize_img_path(struct XorrisO *xorriso, char *img_path,
} else
if(Sfile_str(path, img_path, 0)<=0)
return(-1);
apt= npt= path;
if(path[0]!='/') {
sprintf(xorriso->info_text,
@ -613,7 +613,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
{
struct iso_volume *volume;
struct iso_tree_node *node;
int ret, target_is_dir, source_is_dir;
int ret, target_is_dir, source_is_dir, fret, was_failure= 0;
struct DirseQ *dirseq= NULL;
char sfe[5*SfileadrL], sfe2[5*SfileadrL];
char disk_path[2*SfileadrL], img_path[2*SfileadrL];
@ -660,15 +660,15 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
}
strcpy(img_name, name);
if(Xorriso_much_too_long(xorriso, strlen(img_path), 0)<=0)
goto was_problem;
{ret= 0; goto was_problem;}
if(Xorriso_much_too_long(xorriso, strlen(disk_path), 0)<=0)
goto was_problem;
{ret= 0; goto was_problem;}
if(lstat(disk_path, &stbuf)==-1) {
sprintf(xorriso->info_text,
"Cannot determine attributes of source file %s",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "SORRY", 0);
goto was_problem;
ret= 0; goto was_problem;
}
source_is_dir= 0;
if(S_ISDIR(stbuf.st_mode)) {
@ -677,7 +677,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
sprintf(xorriso->info_text,"Source file %s is of non-supported file type",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
goto was_problem;
ret= 0; goto was_problem;
}
/* does a node exist with this name ? */
@ -697,7 +697,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
sprintf(xorriso->info_text, "User revoked adding of: %s",
Text_shellsafe(disk_path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
goto was_problem;
ret= 0; goto was_problem;
}
node= NULL;
} else {
@ -705,7 +705,7 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
"While grafting %s : file object exists and may not be overwritten",
Text_shellsafe(img_path,sfe,0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
goto was_problem;
ret= 0; goto was_problem;
}
}
}
@ -719,30 +719,31 @@ int Xorriso_add_tree(struct XorrisO *xorriso, struct iso_tree_node_dir *dir,
Text_shellsafe(img_path,sfe,0), Text_shellsafe(disk_path,sfe2,0),
libisofs_errno);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
goto was_problem;
ret=0; goto was_problem;
}
/* name always equal to disk. Obsolete: iso_tree_node_set_name(node,name);*/
if(source_is_dir) {
ret= Xorriso_add_tree(xorriso, (struct iso_tree_node_dir *) node,
img_path, disk_path, 1);
if(ret<0)
{ret= -1; goto ex;}
if(ret==0)
if(ret<=0)
goto was_problem;
}
continue;
continue; /* regular bottom of loop */
was_problem:;
ret= Xorriso_eval_problem_status(xorriso, 0, 1);
if(ret<0)
{ret= 0; goto ex;}
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret<0)
goto ex;
}
ret= 1;
ex:
Xorriso_process_msg_queues(xorriso,0);
Dirseq_destroy(&dirseq, 0);
return(ret);
if(ret<=0)
return(ret);
return(!was_failure);
}
@ -976,7 +977,7 @@ int Xorriso_toc(struct XorrisO *xorriso, int flag)
{
int num_sessions= 0, num_tracks= 0, lba= 0, nwa= -1, pmin, psec, pframe, ret;
int track_count= 0, session_no, track_no, profile_no= -1;
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data;
int last_track_start= 0, last_track_size= -1, num_data= 0, is_data= 0;
char profile_name[80],*respt;
struct burn_disc *disc= NULL;
struct burn_session **sessions;
@ -1425,7 +1426,7 @@ int Xorriso_node_from_path(struct XorrisO *xorriso, struct iso_volume *volume,
int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter,
char *path, int flag)
{
int ret, is_dir= 0, pl, not_removed= 0;
int ret, is_dir= 0, pl, not_removed= 0, fret;
struct iso_tree_node *victim_node, *node;
struct iso_tree_node_dir *boss_node, *root_dir;
struct iso_tree_iter *iter= NULL;
@ -1476,21 +1477,25 @@ int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter,
&& !xorriso->request_to_abort) {
name= (char *) iso_tree_node_get_name(node);
if(Xorriso_much_too_long(xorriso, pl+1+strlen(name), 0)<=0)
{ret= 0; goto ex;}
{ret= 0; goto rm_r_problem_handler;}
strcpy(sub_name, name);
ret= Xorriso_rmi(xorriso, iter, sub_path, (flag&(1|2|8))|4);
if(ret<=0)
goto ex;
if(ret==3)
if(ret==3 || ret<=0 || xorriso->request_to_abort) {
rm_r_problem_handler:;
not_removed= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret<0)
goto dir_not_removed;
}
}
if(not_removed) {
if(!(flag&4)) {
sprintf(xorriso->info_text, "Directory not removed: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
ret= 3; goto ex;
dir_not_removed:;
sprintf(xorriso->info_text, "Directory not removed: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
if(ret>0)
ret= 3;
goto ex;
}
}
} else {
@ -1538,16 +1543,14 @@ int Xorriso_rmi(struct XorrisO *xorriso, void *boss_iter,
sprintf(xorriso->info_text,
"Remove above file ? n= keep it, y= remove it, x= abort, @= stop asking\n");
Xorriso_info(xorriso, 4);
ret= Xorriso_request_confirmation(xorriso, 1|2|4);
ret= Xorriso_request_confirmation(xorriso, 1|2|4|16);
if(ret<=0)
goto ex;
if(xorriso->request_to_abort) {
if(!(flag&4)) {
sprintf(xorriso->info_text,
"Removal operation aborted by user before file: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
}
sprintf(xorriso->info_text,
"Removal operation aborted by user before file: %s",
Text_shellsafe(path, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
ret= 3; goto ex;
}
if(ret==3)
@ -1694,7 +1697,8 @@ much_too_long:;
{ret= -1; goto ex;}
}
filec++;
mem+= strlen(rel_path)+1;
l= strlen(rel_path)+1;
mem+= l;
if(l % sizeof(char *))
mem+= sizeof(char *)-(l % sizeof(char *));
ret= Xorriso_show_du_subs(xorriso, (struct iso_tree_node_dir *) node,
@ -1857,7 +1861,7 @@ much_too_long:;
if(!(flag&(2|4))) {
sprintf(xorriso->info_text, "Valid ISO nodes found: %d\n", filec-was_error);
Xorriso_info(xorriso,0);
Xorriso_info(xorriso,1);
if(filec-was_error<=0)
return(!was_error);
}
@ -1990,7 +1994,7 @@ wdi_is_not_a_dir:;
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text, "Valid ISO nodes found: %d\n", filec);
Xorriso_info(xorriso,0);
Xorriso_info(xorriso,1);
ret= Xorriso_sorted_node_array(xorriso, dir_node, &filec, &node_array, 0,
flag&4);
@ -2113,8 +2117,8 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
}
/* Check whether destination exists and may be not overwriteable */
if(dest_ret==2) {
sprintf(xorriso->info_text, "Renaming refuses to unlink directory: %s",
if(dest_ret==2 && xorriso->do_overwrite!=1) {
sprintf(xorriso->info_text, "Renaming may not overwrite directory: %s",
Text_shellsafe(eff_dest, sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
@ -2124,7 +2128,7 @@ int Xorriso_rename(struct XorrisO *xorriso, char *origin, char *dest, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
} else if(dest_ret>0) {
ret= Xorriso_rmi(xorriso, NULL, eff_dest, 8);
ret= Xorriso_rmi(xorriso, NULL, eff_dest, 1|8);
if(ret<=0)
return(0);
if(ret==3) {
@ -2332,7 +2336,7 @@ int Xorriso_expand_pattern(struct XorrisO *xorriso,
int nonconst_mismatches= 0;
char mem_text[80], limit_text[80], sfe[5*SfileadrL];
struct iso_volume *volume;
struct iso_tree_node_dir *dir, *root_dir;
struct iso_tree_node_dir *dir= NULL, *root_dir;
*filec= 0;
*filev= NULL;