Enabled use of libjte message list

This commit is contained in:
Thomas Schmitt 2010-10-04 11:22:58 +00:00
parent c7a239dae7
commit 7e8a7f417a
5 changed files with 48 additions and 56 deletions

View File

@ -1326,48 +1326,6 @@ not_enough_args:;
if(ret<=0) if(ret<=0)
goto problem_handler_2; goto problem_handler_2;
file_mode= mode_or; file_mode= mode_or;
#ifdef NIX
} else if(strncmp(argv[i], "-jigdo-", 7) == 0) {
char *jkey;
if(i+1>=argc)
goto not_enough_args;
i++;
cpt= argv[i - 1] + 7;
if(strcmp(cpt, "jigdo") == 0)
jkey= "jigdo_path";
else if(strcmp(cpt, "template") == 0)
jkey= "template_path";
else if(strcmp(cpt, "min-file-size") == 0)
jkey= "min_size";
else if(strcmp(cpt, "force-md5") == 0)
jkey= "demand_md5";
else if(strcmp(cpt, "exclude") == 0)
jkey= "exclude";
else if(strcmp(cpt, "map") == 0)
jkey= "mapping";
else {
i--;
goto is_unknown_option_2;
}
ret= Xorriso_jigdo_interpreter(xorriso, jkey, argv[i], 0);
if(ret <= 0)
goto problem_handler_2;
} else if(strncmp(argv[i], "-md5-list", 7) == 0) {
if(i+1>=argc)
goto not_enough_args;
i++;
ret= Xorriso_jigdo_interpreter(xorriso, "md5_path", argv[i], 0);
if(ret <= 0)
goto problem_handler_2;
} else if(argv[i][0]=='-' && argv[i][1]!=0) {
is_unknown_option_2:;
#else /* NIX */
} else if(strcmp(argv[i], "-jigdo-jigdo") == 0 || } else if(strcmp(argv[i], "-jigdo-jigdo") == 0 ||
strcmp(argv[i], "-jigdo-template") == 0 || strcmp(argv[i], "-jigdo-template") == 0 ||
strcmp(argv[i], "-jigdo-min-file-size") == 0 || strcmp(argv[i], "-jigdo-min-file-size") == 0 ||
@ -1382,11 +1340,7 @@ is_unknown_option_2:;
ret= Xorriso_option_jigdo(xorriso, argv[i - 1], argv[i], 0); ret= Xorriso_option_jigdo(xorriso, argv[i - 1], argv[i], 0);
if(ret <= 0) if(ret <= 0)
goto problem_handler_2; goto problem_handler_2;
} else if(argv[i][0]=='-' && argv[i][1]!=0) { } else if(argv[i][0]=='-' && argv[i][1]!=0) {
#endif /* ! NIX */
ret= Xorriso_genisofs_count_args(xorriso, argc - i, argv + i, &count, 1); ret= Xorriso_genisofs_count_args(xorriso, argc - i, argv + i, &count, 1);
if(ret > 0) { if(ret > 0) {
sprintf(xorriso->info_text, "-as %s: Unsupported option %s", sprintf(xorriso->info_text, "-as %s: Unsupported option %s",

View File

@ -417,14 +417,32 @@ cannot:;
int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag) int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag)
{ {
int ret, error_code= 0, os_errno= 0, count= 0, pass, imgid, tunneled; int ret, error_code= 0, os_errno= 0, count= 0, pass, imgid, tunneled;
char severity[80]; int name_prefix_code;
char severity[80], *msg;
if(!xorriso->libs_are_started) if(!xorriso->libs_are_started)
return(1); return(1);
for(pass= 0; pass< 2; pass++) { for(pass= 0; pass< 3; pass++) {
while(1) { while(1) {
tunneled= 0; tunneled= 0;
if(pass==0) if(pass==0) {
ret= 0;
#ifdef Xorriso_with_libjtE
if(xorriso->libjte_handle != NULL) {
msg= libjte_get_next_message(xorriso->libjte_handle);
if(msg != NULL) {
sprintf(xorriso->info_text, "%1.4095s", msg);
free(msg);
strcpy(severity, "NOTE");
error_code= 0;
os_errno= 0;
ret= 1;
}
}
#endif /* Xorriso_with_libjtE */
} else if(pass==1)
ret= iso_obtain_msgs("ALL", &error_code, &imgid, ret= iso_obtain_msgs("ALL", &error_code, &imgid,
xorriso->info_text, severity); xorriso->info_text, severity);
else { else {
@ -448,8 +466,12 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag)
else if(error_code==0x51001) else if(error_code==0x51001)
strcpy(severity, "ERRFILE"); strcpy(severity, "ERRFILE");
if(pass == 0)
name_prefix_code= 0;
else
name_prefix_code= pass + tunneled;
Xorriso_msgs_submit(xorriso, error_code, xorriso->info_text, os_errno, Xorriso_msgs_submit(xorriso, error_code, xorriso->info_text, os_errno,
severity, ((pass+tunneled)+1)<<2); severity, name_prefix_code << 2);
count++; count++;
} }
} }
@ -540,6 +562,8 @@ int Xorriso_assert_jte_handle(struct XorrisO *xorriso, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FATAL", 0);
return(-1); return(-1);
} }
/* no stderr, no exit() */
libjte_set_error_behavior(xorriso->libjte_handle, 0, 0);
} }
return(1); return(1);
} }
@ -555,6 +579,7 @@ int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg,
int ret, num; int ret, num;
struct libjte_env *jte; struct libjte_env *jte;
char *msg = NULL;
if(strcmp(aspect, "clear") == 0) { if(strcmp(aspect, "clear") == 0) {
if(xorriso->libjte_handle != NULL) if(xorriso->libjte_handle != NULL)
@ -569,11 +594,14 @@ int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg,
jte= xorriso->libjte_handle; jte= xorriso->libjte_handle;
if(strcmp(aspect, "verbose") == 0) { if(strcmp(aspect, "verbose") == 0) {
if(strcmp(arg, "on") == 0) if(strcmp(arg, "on") == 0) {
libjte_set_verbose(jte, 1); libjte_set_verbose(jte, 1);
else if(strcmp(arg, "off") == 0) /* Direct libjte messages to stderr, rather than message list */
libjte_set_error_behavior(xorriso->libjte_handle, 1, 0);
} else if(strcmp(arg, "off") == 0) {
libjte_set_verbose(jte, 0); libjte_set_verbose(jte, 0);
else libjte_set_error_behavior(xorriso->libjte_handle, 0, 0);
} else
goto bad_arg; goto bad_arg;
} else if(strcmp(aspect, "template_path") == 0 || } else if(strcmp(aspect, "template_path") == 0 ||
strcmp(aspect, "-jigdo-template") == 0) { strcmp(aspect, "-jigdo-template") == 0) {
@ -641,7 +669,7 @@ int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg,
Xorriso_no_malloc_memory(xorriso, NULL, 0); Xorriso_no_malloc_memory(xorriso, NULL, 0);
return(-1); return(-1);
} }
Xorriso_process_msg_queues(xorriso, 0);
return(1); return(1);
bad_arg: bad_arg:
@ -650,6 +678,15 @@ bad_arg:
return(0); return(0);
jte_failed: jte_failed:
while(1) {
msg= libjte_get_next_message(xorriso->libjte_handle);
if(msg == NULL)
break;
sprintf(xorriso->info_text, "%1.4095s", msg);
free(msg);
msg= NULL;
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
}
sprintf(xorriso->info_text, "Experienced libjte failure with: -jigdo %s %s", sprintf(xorriso->info_text, "Experienced libjte failure with: -jigdo %s %s",
aspect, arg); aspect, arg);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);

View File

@ -1376,7 +1376,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Specifies the name of the Abstract File. (37 chars)", " Specifies the name of the Abstract File. (37 chars)",
" -joliet \"on\"|\"off\"", " -joliet \"on\"|\"off\"",
" Generate Joliet info additional to Rock Ridge info.", " Generate Joliet info additional to Rock Ridge info.",
" -jigdo \"clear\"|\"verbose\"|\"template_path\"|\"jigdo_path\"|\"md5_path\"", " -jigdo \"clear\"|\"template_path\"|\"jigdo_path\"|\"md5_path\"",
" |\"min_size\"|\"checksum_iso\"|\"checksum_template\"", " |\"min_size\"|\"checksum_iso\"|\"checksum_template\"",
" |\"compression\"|\"exclude\"|\"demand_md5\"|\"mapping\"", " |\"compression\"|\"exclude\"|\"demand_md5\"|\"mapping\"",
" |\"checksum_iso\"|\"checksum_template\"", " |\"checksum_iso\"|\"checksum_template\"",

View File

@ -747,6 +747,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
#ifdef Xorriso_with_libjtE #ifdef Xorriso_with_libjtE
if(xorriso->libjte_handle) { if(xorriso->libjte_handle) {
ret= libjte_set_outfile(xorriso->libjte_handle, xorriso->outdev); ret= libjte_set_outfile(xorriso->libjte_handle, xorriso->outdev);
Xorriso_process_msg_queues(xorriso, 0);
if(ret <= 0) if(ret <= 0)
goto ex; goto ex;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2010.10.03.171305" #define Xorriso_timestamP "2010.10.04.112234"