New option -error_behavior with a first occasion image_loading
This commit is contained in:
@ -2445,6 +2445,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
||||
m->problem_status_text[0]= 0;
|
||||
m->errfile_log[0]= 0;
|
||||
m->errfile_fp= NULL;
|
||||
m->img_read_error_mode= 2; /* abort faulty image reading with FATAL */
|
||||
strcpy(m->return_with_text, "SORRY");
|
||||
Xorriso__text_to_sev(m->return_with_text, &m->return_with_severity, 0);
|
||||
m->return_with_value= 32;
|
||||
@ -3537,6 +3538,16 @@ 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= (xorriso->img_read_error_mode==2);
|
||||
treatment= "best_effort";
|
||||
if(xorriso->img_read_error_mode==1)
|
||||
treatment= "failure";
|
||||
else if(xorriso->img_read_error_mode==2)
|
||||
treatment= "fatal";
|
||||
sprintf(line,"-error_behavior image_loading %s\n", treatment);
|
||||
if(!(is_default && no_defaults))
|
||||
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
||||
|
||||
is_default= (xorriso->mark_text[0]==0);
|
||||
sprintf(line,"-mark %s\n",Text_shellsafe(xorriso->mark_text,sfe,0));
|
||||
if(!(is_default && no_defaults))
|
||||
@ -8224,6 +8235,34 @@ int Xorriso_option_errfile_log(struct XorrisO *xorriso,
|
||||
}
|
||||
|
||||
|
||||
/* Option -error_behavior */
|
||||
int Xorriso_option_error_behavior(struct XorrisO *xorriso,
|
||||
char *occasion, char *behavior, int flag)
|
||||
{
|
||||
if(strcmp(occasion, "image_loading")==0) {
|
||||
if(strcmp(behavior, "best_effort")==0)
|
||||
xorriso->img_read_error_mode= 0;
|
||||
else if(strcmp(behavior, "failure")==0 || strcmp(behavior, "FAILURE")==0)
|
||||
xorriso->img_read_error_mode= 1;
|
||||
else if(strcmp(behavior, "fatal")==0 || strcmp(behavior, "FATAL")==0)
|
||||
xorriso->img_read_error_mode= 2;
|
||||
else {
|
||||
sprintf(xorriso->info_text,
|
||||
"-error_behavior: with 'image_loading': unknown behavior '%s'",
|
||||
behavior);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
} else {
|
||||
sprintf(xorriso->info_text, "-error_behavior: unknown occasion '%s'",
|
||||
occasion);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
/* Option -follow */
|
||||
int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag)
|
||||
{
|
||||
@ -10336,6 +10375,10 @@ next_command:;
|
||||
(*idx)+= 2;
|
||||
ret= Xorriso_option_errfile_log(xorriso, arg1, arg2, 0);
|
||||
|
||||
} else if(strcmp(cmd,"error_behavior")==0) {
|
||||
(*idx)+= 2;
|
||||
ret= Xorriso_option_error_behavior(xorriso, arg1, arg2, 0);
|
||||
|
||||
} else if(strcmp(cmd,"iso_rr_pattern")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0);
|
||||
|
Reference in New Issue
Block a user