From e942108ad7e5c8d194c965b865c12d90302f330d Mon Sep 17 00:00:00 2001 From: Thomas Schmitt Date: Mon, 4 Oct 2010 11:22:58 +0000 Subject: [PATCH] Enabled use of libjte message list --- xorriso/emulators.c | 46 -------------------------------- xorriso/lib_mgt.c | 53 +++++++++++++++++++++++++++++++------ xorriso/opts_d_h.c | 2 +- xorriso/write_run.c | 1 + xorriso/xorriso_timestamp.h | 2 +- 5 files changed, 48 insertions(+), 56 deletions(-) diff --git a/xorriso/emulators.c b/xorriso/emulators.c index eeb18ed3..16fc62e7 100644 --- a/xorriso/emulators.c +++ b/xorriso/emulators.c @@ -1326,48 +1326,6 @@ not_enough_args:; if(ret<=0) goto problem_handler_2; 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 || strcmp(argv[i], "-jigdo-template") == 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); if(ret <= 0) goto problem_handler_2; - } else if(argv[i][0]=='-' && argv[i][1]!=0) { - -#endif /* ! NIX */ - ret= Xorriso_genisofs_count_args(xorriso, argc - i, argv + i, &count, 1); if(ret > 0) { sprintf(xorriso->info_text, "-as %s: Unsupported option %s", diff --git a/xorriso/lib_mgt.c b/xorriso/lib_mgt.c index 3c110529..e308e623 100644 --- a/xorriso/lib_mgt.c +++ b/xorriso/lib_mgt.c @@ -417,14 +417,32 @@ cannot:; int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag) { 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) return(1); - for(pass= 0; pass< 2; pass++) { + for(pass= 0; pass< 3; pass++) { while(1) { 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, xorriso->info_text, severity); else { @@ -448,8 +466,12 @@ int Xorriso_process_msg_queues(struct XorrisO *xorriso, int flag) else if(error_code==0x51001) 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, - severity, ((pass+tunneled)+1)<<2); + severity, name_prefix_code << 2); 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); return(-1); } + /* no stderr, no exit() */ + libjte_set_error_behavior(xorriso->libjte_handle, 0, 0); } return(1); } @@ -555,6 +579,7 @@ int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg, int ret, num; struct libjte_env *jte; + char *msg = NULL; if(strcmp(aspect, "clear") == 0) { if(xorriso->libjte_handle != NULL) @@ -569,11 +594,14 @@ int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg, jte= xorriso->libjte_handle; if(strcmp(aspect, "verbose") == 0) { - if(strcmp(arg, "on") == 0) + if(strcmp(arg, "on") == 0) { 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); - else + libjte_set_error_behavior(xorriso->libjte_handle, 0, 0); + } else goto bad_arg; } else if(strcmp(aspect, "template_path") == 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); return(-1); } - + Xorriso_process_msg_queues(xorriso, 0); return(1); bad_arg: @@ -650,6 +678,15 @@ bad_arg: return(0); 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", aspect, arg); Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0); diff --git a/xorriso/opts_d_h.c b/xorriso/opts_d_h.c index 733301ce..8dd96e4a 100644 --- a/xorriso/opts_d_h.c +++ b/xorriso/opts_d_h.c @@ -1376,7 +1376,7 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag) " Specifies the name of the Abstract File. (37 chars)", " -joliet \"on\"|\"off\"", " 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\"", " |\"compression\"|\"exclude\"|\"demand_md5\"|\"mapping\"", " |\"checksum_iso\"|\"checksum_template\"", diff --git a/xorriso/write_run.c b/xorriso/write_run.c index b742e4db..d9b28ebc 100644 --- a/xorriso/write_run.c +++ b/xorriso/write_run.c @@ -747,6 +747,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag) #ifdef Xorriso_with_libjtE if(xorriso->libjte_handle) { ret= libjte_set_outfile(xorriso->libjte_handle, xorriso->outdev); + Xorriso_process_msg_queues(xorriso, 0); if(ret <= 0) goto ex; diff --git a/xorriso/xorriso_timestamp.h b/xorriso/xorriso_timestamp.h index 8fa90d08..430834a1 100644 --- a/xorriso/xorriso_timestamp.h +++ b/xorriso/xorriso_timestamp.h @@ -1 +1 @@ -#define Xorriso_timestamP "2010.10.03.171305" +#define Xorriso_timestamP "2010.10.04.112234"