Gave -as mkisofs problem handlers rather than to let it abort on any error

This commit is contained in:
Thomas Schmitt 2008-11-30 12:37:26 +00:00
parent 327412eb54
commit 186bc564a0
2 changed files with 30 additions and 15 deletions

View File

@ -9199,7 +9199,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
{
int ret, i, was_path= 0, was_other_option= 0, mem_graft_points, mem;
int do_print_size= 0, fd, idx, iso_level= 0, no_emul_boot= 0;
int option_b= 0;
int option_b= 0, was_failure= 0, fret;
char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL];
char *ept, *add_pt, eff_path[SfileadrL], indev[SfileadrL+8], msc[80], *cpt;
@ -9320,7 +9320,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
} else if(strcmp(argv[i], "-f")==0 || strcmp(argv[i], "-follow-links")==0) {
ret= Xorriso_option_follow(xorriso, "on", 0);
if(ret<=0)
goto ex;
goto problem_handler_1;
} else if(strcmp(argv[i], "-iso-level")==0) {
if(i+1>=argc)
goto not_enough_args;
@ -9331,7 +9331,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
"-as %s: unsupported -iso-level '%s' (use one of: 1,2,3)",
whom, argv[i]);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
ret= 0; goto ex;
ret= 0; goto problem_handler_1;
}
if(iso_level < 3)
xorriso->file_size_limit=
@ -9379,9 +9379,17 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
sprintf(sfe, "isohybrid=%s", argv[i] + 13);
ret= Xorriso_option_boot_image(xorriso, "isolinux", sfe, 0);
if(ret <= 0)
goto ex;
goto problem_handler_1;
} else
was_other_option= 1;
continue; /* regular bottom of loop */
problem_handler_1:;
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
Xorriso_option_report_about(xorriso, ra_text, 0);
if(adr[0]) {
@ -9508,12 +9516,12 @@ not_enough_args:;
ret= 0; goto ex;
}
i++;
was_path= 1;
xorriso->pacifier_style= 1;
ret= Xorriso_option_path_list(xorriso, argv[i],
(strcmp(argv[i-1], "--quoted_path_list")==0));
if(ret<=0)
goto ex;
was_path= 1;
xorriso->pacifier_style= 1;
goto problem_handler_2;
} else if(strcmp(argv[i], "-f")==0 || strcmp(argv[i], "-follow-links")==0) {
/* was already handled in first argument scan */;
} else if(strcmp(argv[i], "-pad")==0) {
@ -9539,14 +9547,14 @@ not_enough_args:;
i++;
ret= Xorriso_option_volid(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
goto problem_handler_2;
} else if(strcmp(argv[i], "-P")==0 || strcmp(argv[i], "-publisher")==0) {
if(i+1>=argc)
goto not_enough_args;
i++;
ret= Xorriso_option_publisher(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
goto problem_handler_2;
} else if(strcmp(argv[i], "-m")==0 || strcmp(argv[i], "-exclude")==0 ||
strcmp(argv[i], "-x")==0 || strcmp(argv[i], "-old-exclude")==0) {
if(i+1>=argc)
@ -9561,7 +9569,7 @@ not_enough_args:;
ret= Xorriso_option_not_leaf(xorriso, argv[i], 0);
xorriso->do_disk_pattern= mem;
if(ret<=0)
goto ex;
goto problem_handler_2;
} else if(strcmp(argv[i], "-exclude-list")==0) {
if(i+1>=argc)
goto not_enough_args;
@ -9571,7 +9579,7 @@ not_enough_args:;
ret= Xorriso_option_not_list(xorriso, argv[i], 0);
xorriso->do_disk_pattern= mem;
if(ret<=0)
goto ex;
goto problem_handler_2;
} else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i], "-quiet")==0) {
/* was already handled in first argument scan */;
@ -9608,7 +9616,7 @@ not_enough_args:;
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, argv[i],
eff_path, 2|4);
if(ret<=0)
goto ex;
goto problem_handler_2;
ret= Sfile_type(eff_path,
1|((xorriso->do_follow_param||xorriso->do_follow_links)<<2));
if(ret==2) {
@ -9631,10 +9639,17 @@ not_enough_args:;
ret= Xorriso_option_add(xorriso, 1, &add_pt, &zero, was_path<<1);
xorriso->allow_graft_points= mem_graft_points;
if(ret<=0)
goto ex;
goto problem_handler_2;
was_path= 1;
xorriso->pacifier_style= 1;
}
continue; /* regular bottom of loop */
problem_handler_2:;
was_failure= 1;
fret= Xorriso_eval_problem_status(xorriso, ret, 1|2);
if(fret>=0)
continue;
goto ex;
}
if(do_print_size) {
ret= Xorriso_option_print_size(xorriso, 1);
@ -9642,7 +9657,7 @@ not_enough_args:;
goto ex;
}
ret= 1;
ret= !was_failure;
ex:;
if(was_path && !do_print_size)
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.11.30.095007"
#define Xorriso_timestamP "2008.11.30.123700"