|
|
|
@ -90,6 +90,10 @@ or
|
|
|
|
|
#include <pwd.h>
|
|
|
|
|
#include <grp.h>
|
|
|
|
|
|
|
|
|
|
/* for -charset */
|
|
|
|
|
#include <iconv.h>
|
|
|
|
|
#include <langinfo.h>
|
|
|
|
|
|
|
|
|
|
/* eventually, this is done in xorriso_private.h : #include <regex.h> */
|
|
|
|
|
|
|
|
|
|
#ifdef Xorriso_with_readlinE
|
|
|
|
@ -3659,12 +3663,14 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
|
|
|
|
|
m->indev[0]= 0;
|
|
|
|
|
m->in_drive_handle= NULL;
|
|
|
|
|
m->in_volset_handle= NULL;
|
|
|
|
|
m->in_charset= NULL;
|
|
|
|
|
m->volset_change_pending= 0;
|
|
|
|
|
m->no_volset_present= 0;
|
|
|
|
|
m->in_sector_map= NULL;
|
|
|
|
|
m->check_media_default= NULL;
|
|
|
|
|
m->outdev[0]= 0;
|
|
|
|
|
m->out_drive_handle= NULL;
|
|
|
|
|
m->out_charset= NULL;
|
|
|
|
|
m->dev_fd_1= -1;
|
|
|
|
|
m->grow_blindly_msc2= -1;
|
|
|
|
|
m->ban_stdio_write= 0;
|
|
|
|
@ -3827,6 +3833,10 @@ int Xorriso_destroy(struct XorrisO **xorriso, int flag)
|
|
|
|
|
m= *xorriso;
|
|
|
|
|
if(m==NULL)
|
|
|
|
|
return(0);
|
|
|
|
|
if(m->in_charset!=NULL)
|
|
|
|
|
free(m->in_charset);
|
|
|
|
|
if(m->out_charset!=NULL)
|
|
|
|
|
free(m->out_charset);
|
|
|
|
|
Xorriso_destroy_re(m,0);
|
|
|
|
|
Exclusions_destroy(&(m->disk_exclusions), 0);
|
|
|
|
|
Xorriso_detach_libraries(m, flag&1);
|
|
|
|
@ -5342,6 +5352,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
|
|
|
|
|
{
|
|
|
|
|
int is_default, no_defaults, i, ret, adr_mode, bin_path_in_use= 0;
|
|
|
|
|
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment;
|
|
|
|
|
char *in_pt, *out_pt;
|
|
|
|
|
static char channel_prefixes[4][4]= {".","R","I","M"};
|
|
|
|
|
static char load_names[][20]= {"auto", "session", "track", "lba", "volid"};
|
|
|
|
|
static int max_load_mode= 4;
|
|
|
|
@ -5826,7 +5837,28 @@ 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);
|
|
|
|
|
|
|
|
|
|
if(strcmp(xorriso->indev,xorriso->outdev)==0) {
|
|
|
|
|
is_default= (xorriso->out_charset == NULL && xorriso->in_charset == NULL);
|
|
|
|
|
in_pt= "";
|
|
|
|
|
if(xorriso->in_charset != NULL)
|
|
|
|
|
in_pt= xorriso->in_charset;
|
|
|
|
|
out_pt= "";
|
|
|
|
|
if(xorriso->out_charset != NULL)
|
|
|
|
|
out_pt= xorriso->out_charset;
|
|
|
|
|
if(strcmp(in_pt, out_pt) == 0 &&
|
|
|
|
|
strncmp(filter, "-in_charset", 11) != 0 &&
|
|
|
|
|
strncmp(filter, "-out_charset", 12) != 0) {
|
|
|
|
|
sprintf(line, "-charset %s\n", Text_shellsafe(in_pt, sfe, 0));
|
|
|
|
|
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
|
|
|
|
} else {
|
|
|
|
|
sprintf(line, "-in_charset %s\n", Text_shellsafe(in_pt, sfe, 0));
|
|
|
|
|
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
|
|
|
|
sprintf(line, "-out_charset %s\n", Text_shellsafe(out_pt, sfe, 0));
|
|
|
|
|
Xorriso_status_result(xorriso, filter, fp, flag & 2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(strcmp(xorriso->indev, xorriso->outdev) == 0 &&
|
|
|
|
|
strncmp(filter, "-indev", 6) != 0 &&
|
|
|
|
|
strncmp(filter, "-outdev", 7) != 0) {
|
|
|
|
|
sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
|
|
|
|
|
Xorriso_status_result(xorriso,filter,fp,flag&2);
|
|
|
|
|
} else {
|
|
|
|
@ -10771,6 +10803,64 @@ int Xorriso_option_cdx(struct XorrisO *xorriso, char *disk_path, int flag)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -charset */
|
|
|
|
|
/* @param flag bit0= set in_charset
|
|
|
|
|
bit1= set out_charset
|
|
|
|
|
*/
|
|
|
|
|
int Xorriso_option_charset(struct XorrisO *xorriso, char *name, int flag)
|
|
|
|
|
{
|
|
|
|
|
char *name_pt= NULL, sfe[5 * SfileadrL];
|
|
|
|
|
iconv_t iconv_ret= (iconv_t) -1;
|
|
|
|
|
|
|
|
|
|
if(name != NULL)
|
|
|
|
|
if(name[0] != 0)
|
|
|
|
|
name_pt= name;
|
|
|
|
|
if(flag & 1) {
|
|
|
|
|
if(name_pt != NULL) {
|
|
|
|
|
iconv_ret= iconv_open(nl_langinfo(CODESET), name_pt);
|
|
|
|
|
if(iconv_ret == (iconv_t) -1) {
|
|
|
|
|
sprintf(xorriso->info_text,
|
|
|
|
|
"-%scharset: Cannot convert from charset %s",
|
|
|
|
|
flag & 2 ? "" : "in_", Text_shellsafe(name_pt, sfe, 0));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
|
|
|
|
|
0);
|
|
|
|
|
return(0);
|
|
|
|
|
} else
|
|
|
|
|
iconv_close(iconv_ret);
|
|
|
|
|
}
|
|
|
|
|
if(Sregex_string(&(xorriso->in_charset), name_pt, 0) <= 0) {
|
|
|
|
|
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
|
|
|
|
return(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(flag & 2) {
|
|
|
|
|
if(name_pt != NULL) {
|
|
|
|
|
iconv_ret= iconv_open(nl_langinfo(CODESET), name_pt);
|
|
|
|
|
if(iconv_ret == (iconv_t) -1) {
|
|
|
|
|
sprintf(xorriso->info_text, "-%scharset: Cannot convert to charset %s",
|
|
|
|
|
flag & 1 ? "" : "out_", Text_shellsafe(name_pt, sfe, 0));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "FAILURE",
|
|
|
|
|
0);
|
|
|
|
|
return(0);
|
|
|
|
|
} else
|
|
|
|
|
iconv_close(iconv_ret);
|
|
|
|
|
}
|
|
|
|
|
if(Sregex_string(&(xorriso->out_charset), name_pt, 0) <= 0) {
|
|
|
|
|
Xorriso_no_malloc_memory(xorriso, NULL, 0);
|
|
|
|
|
return(-1);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(name_pt == NULL)
|
|
|
|
|
name_pt= nl_langinfo(CODESET);
|
|
|
|
|
sprintf(xorriso->info_text, "Character set for %sconversion is now: %s",
|
|
|
|
|
(flag & 3) == 1 ? "input " : (flag & 3) == 2 ? "output " : "",
|
|
|
|
|
Text_shellsafe(name_pt, sfe, 0));
|
|
|
|
|
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, errno, "NOTE", 0);
|
|
|
|
|
return(1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Option -check_media */
|
|
|
|
|
int Xorriso_option_check_media(struct XorrisO *xorriso,
|
|
|
|
|
int argc, char **argv, int *idx, int flag)
|
|
|
|
@ -14670,11 +14760,12 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
|
|
|
|
};
|
|
|
|
|
static char arg1_commands[][40]= {
|
|
|
|
|
"abort_on","add_plainly","backslash_codes","blank",
|
|
|
|
|
"cd","cdi","cdx","close","commit_eject",
|
|
|
|
|
"cd","cdi","cdx","charset","close","commit_eject",
|
|
|
|
|
"dev", "dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
|
|
|
|
|
"format","fs","gid","grow_blindly",
|
|
|
|
|
"history","indev","joliet","list_delimiter","mark","not_leaf",
|
|
|
|
|
"not_list","not_mgt","options_from_file","osirrox","outdev","overwrite",
|
|
|
|
|
"history","indev","in_charset","joliet","list_delimiter",
|
|
|
|
|
"mark","not_leaf","not_list","not_mgt",
|
|
|
|
|
"options_from_file","osirrox","outdev","out_charset","overwrite",
|
|
|
|
|
"pacifier","padding","path_list","pathspecs","pkt_output","print","prompt",
|
|
|
|
|
"prog","prog_help","publisher","quoted_not_list","quoted_path_list",
|
|
|
|
|
"reassure","report_about","rom_toc_scan",
|
|
|
|
@ -14866,6 +14957,10 @@ next_command:;
|
|
|
|
|
(*idx)++;
|
|
|
|
|
ret= Xorriso_option_cdx(xorriso, arg1, 0);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"charset")==0) {
|
|
|
|
|
(*idx)++;
|
|
|
|
|
ret= Xorriso_option_charset(xorriso, arg1, 3);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"check_media")==0) {
|
|
|
|
|
ret= Xorriso_option_check_media(xorriso, argc, argv, idx, 0);
|
|
|
|
|
|
|
|
|
@ -15049,6 +15144,10 @@ next_command:;
|
|
|
|
|
(*idx)++;
|
|
|
|
|
ret= Xorriso_option_dev(xorriso, arg1, 1);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"in_charset")==0) {
|
|
|
|
|
(*idx)++;
|
|
|
|
|
ret= Xorriso_option_charset(xorriso, arg1, 1);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"iso_rr_pattern")==0) {
|
|
|
|
|
(*idx)++;
|
|
|
|
|
ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0);
|
|
|
|
@ -15131,13 +15230,17 @@ next_command:;
|
|
|
|
|
if(ret==3)
|
|
|
|
|
goto ex;
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"osirrox")==0) {
|
|
|
|
|
(*idx)++;
|
|
|
|
|
ret= Xorriso_option_osirrox(xorriso,arg1,0);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"outdev")==0) {
|
|
|
|
|
(*idx)++;
|
|
|
|
|
ret= Xorriso_option_dev(xorriso, arg1, 2);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"osirrox")==0) {
|
|
|
|
|
} else if(strcmp(cmd,"out_charset")==0) {
|
|
|
|
|
(*idx)++;
|
|
|
|
|
ret= Xorriso_option_osirrox(xorriso,arg1,0);
|
|
|
|
|
ret= Xorriso_option_charset(xorriso, arg1, 2);
|
|
|
|
|
|
|
|
|
|
} else if(strcmp(cmd,"overwrite")==0) {
|
|
|
|
|
(*idx)++;
|
|
|
|
|