New -as mkisofs options -jigdo-* and -md5-list as of genisoimage
This commit is contained in:
@ -23,11 +23,15 @@
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <stdint.h>
|
||||
|
||||
/* for -charset */
|
||||
#include <iconv.h>
|
||||
#include <langinfo.h>
|
||||
|
||||
#ifdef Xorriso_with_libjtE
|
||||
#include <libjte/libjte.h>
|
||||
#endif
|
||||
|
||||
#include "xorriso.h"
|
||||
#include "xorriso_private.h"
|
||||
@ -521,3 +525,117 @@ int Xorriso_preparer_string(struct XorrisO *xorriso, char xorriso_id[129],
|
||||
return(1);
|
||||
}
|
||||
|
||||
|
||||
#ifdef Xorriso_with_libjtE
|
||||
|
||||
int Xorriso_assert_jte_handle(struct XorrisO *xorriso, int flag)
|
||||
{
|
||||
int ret;
|
||||
|
||||
if(xorriso->libjte_handle == NULL) {
|
||||
ret= libjte_new(&(xorriso->libjte_handle), 0);
|
||||
if(ret <= 0 || xorriso->libjte_handle == NULL)
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
}
|
||||
|
||||
#endif /* Xorriso_with_libjtE */
|
||||
|
||||
|
||||
int Xorriso_jigdo_interpreter(struct XorrisO *xorriso, char *aspect, char *arg,
|
||||
int flag)
|
||||
{
|
||||
|
||||
#ifdef Xorriso_with_libjtE
|
||||
|
||||
int ret, num;
|
||||
struct libjte_env *jte;
|
||||
|
||||
if(strcmp(aspect, "clear") == 0) {
|
||||
if(xorriso->libjte_handle != NULL)
|
||||
libjte_destroy(&(xorriso->libjte_handle));
|
||||
return(1);
|
||||
}
|
||||
ret= Xorriso_assert_jte_handle(xorriso, 0);
|
||||
if(ret <= 0)
|
||||
return(ret);
|
||||
jte= xorriso->libjte_handle;
|
||||
|
||||
if(strcmp(aspect, "verbose") == 0) {
|
||||
if(strcmp(arg, "on") == 0)
|
||||
libjte_set_verbose(jte, 1);
|
||||
else if(strcmp(arg, "off") == 0)
|
||||
libjte_set_verbose(jte, 0);
|
||||
else
|
||||
goto bad_arg;
|
||||
} else if(strcmp(aspect, "template_path") == 0) {
|
||||
ret= libjte_set_template_out(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "jigdo_path") == 0) {
|
||||
ret= libjte_set_jjigdo_out(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "md5_path") == 0) {
|
||||
ret= libjte_set_jmd5_list(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "min_size") == 0) {
|
||||
num= Scanf_io_size(arg, 0);
|
||||
ret= libjte_set_jte_min_size(jte, num);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "checksum_iso") == 0) {
|
||||
ret= libjte_set_checksum_algo_iso(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "checksum_template") == 0) {
|
||||
ret= libjte_set_checksum_algo_tmpl(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "compression") == 0) {
|
||||
ret= libjte_set_jte_template_compression(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "exclude") == 0) {
|
||||
ret= libjte_add_exclude(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "demand_md5") == 0) {
|
||||
ret= libjte_add_include(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else if(strcmp(aspect, "mapping") == 0) {
|
||||
ret= libjte_add_mapping(jte, arg);
|
||||
if(ret <= 0)
|
||||
goto jte_failed;
|
||||
} else {
|
||||
sprintf(xorriso->info_text, "-jigdo: unknown aspect '%s'", aspect);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
return(1);
|
||||
|
||||
bad_arg:
|
||||
sprintf(xorriso->info_text, "-jigdo %s : unknown argument '%s'", aspect, arg);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
|
||||
jte_failed:
|
||||
sprintf(xorriso->info_text, "Experienced libjte failure with: -jigdo %s %s",
|
||||
aspect, arg);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
|
||||
#else /* Xorriso_with_libjtE */
|
||||
|
||||
sprintf(xorriso->info_text,
|
||||
"Jigdo Template Extraction was not enabled at compile time");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
|
||||
#endif /* ! Xorriso_with_libjtE */
|
||||
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user