New option -application_id

This commit is contained in:
Thomas Schmitt 2008-11-04 16:22:51 +00:00
parent 8286998e04
commit cfdee429d9
7 changed files with 123 additions and 13 deletions

View File

@ -1353,6 +1353,10 @@ If you insist in -volid "ISOIMAGE", set it again after those commands.
Set the publisher string to be written with the next -commit. Permissible
are up to 128 characters.
.TP
\fB\-application_id\fR text
Set the application id string to be written with the next -commit. Permissible
are up to 128 characters.
.TP
\fB\-out_charset\fR character_set_name
Set the character set to which file names get converted when writing an
image. See paragraph "Character sets" for more explanations.

View File

@ -3647,6 +3647,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->loaded_volid[0]= 0;
m->volid_default= 1;
m->publisher[0]= 0;
m->application_id[0]= 0;
m->session_logfile[0]= 0;
m->session_lba= -1;
m->session_blocks= 0;
@ -5350,7 +5351,7 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
-options_from_file:${resume_state_file}_pos
*/
{
int is_default, no_defaults, i, ret, adr_mode, bin_path_in_use= 0;
int is_default, no_defaults, i, ret, adr_mode, bin_path_in_use= 0, do_single;
char *line, sfe[5 * SfileadrL + 80], mode[80], *form, *treatment;
char *in_pt, *out_pt;
static char channel_prefixes[4][4]= {".","R","I","M"};
@ -5662,6 +5663,12 @@ 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);
is_default= (xorriso->application_id[0]==0);
sprintf(line,"-application_id %s\n",
Text_shellsafe(xorriso->application_id,sfe,0));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= (xorriso->do_joliet==0);
sprintf(line,"-joliet %s\n", (xorriso->do_joliet == 1 ? "on" : "off"));
if(!(is_default && no_defaults))
@ -5844,21 +5851,30 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
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) {
do_single= 0;
if(filter != NULL)
if(strncmp(filter, "-in_charset", 11) == 0 ||
strncmp(filter, "-out_charset", 12) == 0)
do_single= 1;
if(strcmp(in_pt, out_pt) == 0 && !do_single) {
sprintf(line, "-charset %s\n", Text_shellsafe(in_pt, sfe, 0));
Xorriso_status_result(xorriso, filter, fp, flag & 2);
if(!(is_default && no_defaults))
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);
if(!(is_default && no_defaults))
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(!(is_default && no_defaults))
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) {
do_single= 0;
if(filter != NULL)
if(strncmp(filter, "-indev", 6) == 0 ||
strncmp(filter, "-outdev", 7) == 0)
do_single= 1;
if(strcmp(xorriso->indev, xorriso->outdev) == 0 && !do_single) {
sprintf(line,"-dev %s\n", Text_shellsafe(xorriso->indev,sfe,0));
Xorriso_status_result(xorriso,filter,fp,flag&2);
} else {
@ -10342,6 +10358,28 @@ ex:;
}
/* Option -application_id */
int Xorriso_option_application_id(struct XorrisO *xorriso, char *name,
int flag)
{
if(strlen(name)>=sizeof(xorriso->application_id)) {
sprintf(xorriso->info_text,
"Name too long with option -application_id (%d > %d)",
(int) strlen(name), (int) sizeof(xorriso->application_id)-1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
#ifdef NIX
Xorriso_set_application_id(xorriso, name, 0);
#endif
if(Sfile_str(xorriso->application_id,name,0)<=0)
return(-1);
return(1);
}
/* Option -as */
/* @param flag bit0=do not report the added item
bit1=do not reset pacifier, no final pacifier message
@ -12373,6 +12411,12 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -rom_toc_scan \"on\"|\"off\"[:\"emul_on\"|\"emul_off\"]",
" Enable scanning for ISO sessions on read-only drives/media",
" resp. on overwriteable media with emulated TOC.",
" -charset name Set the character set name to be use for file name",
" conversion from and to media.",
" -in_charset name",
" Like -charset but only for conversion from media.",
" -out_charset name",
" Like -charset but only for conversion to media.",
" -ban_stdio_write",
" Allow for writing only the usage of optical drives.",
" -blank \"fast\"|\"all\"|\"deformat\"|\"deformat_quickest\"",
@ -12383,6 +12427,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Specifies the volume ID text. (32 chars out of [A-Z0-9_])",
" -publisher name",
" Specifies the publisher name. (128 chars)",
" -application_id name",
" Specifies the application id. (128 chars)",
" -joliet \"on\"|\"off\"",
" Generate Joliet info additional to Rock Ridge info.",
" -boot_image \"any\"|\"isolinux\" \"discard\"|\"keep\"|\"patch\"|\"dir=\"",
@ -14037,7 +14083,9 @@ int Xorriso_option_prompt(struct XorrisO *xorriso, char *text, int flag)
/* Option -publisher */
int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag)
{
#ifdef NIX
int ret;
#endif
if(strlen(name)>=sizeof(xorriso->publisher)) {
sprintf(xorriso->info_text,
@ -14046,9 +14094,13 @@ int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag)
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
#ifdef NIX
ret= Xorriso_set_publisher(xorriso, name, 0);
if(ret<=0)
return(ret);
#endif /* NIX */
if(Sfile_str(xorriso->publisher,name,0)<=0)
return(-1);
return(1);
@ -14759,7 +14811,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
""
};
static char arg1_commands[][40]= {
"abort_on","add_plainly","backslash_codes","blank",
"abort_on","add_plainly","application_id","backslash_codes","blank",
"cd","cdi","cdx","charset","close","commit_eject",
"dev", "dummy","dialog","disk_pattern","eject","iso_rr_pattern","follow",
"format","fs","gid","grow_blindly",
@ -14931,6 +14983,10 @@ next_command:;
ret= Xorriso_option_alter_date(xorriso, arg1, arg2, argc, argv, idx,
strlen(cmd)>10);
} else if(strcmp(cmd,"application_id")==0) {
(*idx)++;
ret= Xorriso_option_application_id(xorriso, arg1, 0);
} else if(strcmp(cmd,"as")==0) {
ret= Xorriso_option_as(xorriso, argc, argv, idx, 0);

View File

@ -282,6 +282,10 @@ int Xorriso_option_alter_date(struct XorrisO *xorriso,
char *time_type, char *timestring,
int argc, char **argv, int *idx, int flag);
/* Option -application_id */
int Xorriso_option_application_id(struct XorrisO *xorriso, char *name,
int flag);
/* Option -as */
/* @param flag bit0=do not report the added item
bit1=do not reset pacifier, no final pacifier message
@ -312,6 +316,12 @@ int Xorriso_option_cdi(struct XorrisO *xorriso, char *iso_rr_path, int flag);
/* Option -cdx */
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);
/* Option -check_media */
int Xorriso_option_check_media(struct XorrisO *xorriso,
int argc, char **argv, int *idx, int flag);

View File

@ -125,6 +125,7 @@ struct XorrisO { /* the global context of xorriso */
char loaded_volid[33];
char publisher[129];
char application_id[129];
char session_logfile[SfileadrL];
int session_lba;

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.11.03.115721"
#define Xorriso_timestamP "2008.11.04.162214"

View File

@ -1091,8 +1091,13 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
relax= isoburn_igopt_allow_deep_paths;
xorriso->alignment= 0;
/* Activate, adjust or discard boot image */
image= isoburn_get_attached_image(source_drive);
if(image != NULL) {
iso_image_set_application_id(image, xorriso->application_id);
iso_image_set_publisher_id(image, xorriso->publisher);
}
/* Activate, adjust or discard boot image */
/* >>> ??? move down to libisoburn ? */
if(image!=NULL && !(flag&1)) {
ret= iso_image_get_boot_image(image, &bootimg, NULL, NULL);
@ -6645,6 +6650,8 @@ int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag)
}
#ifdef NIX
/* @param flag bit0= do not mark image as changed */
int Xorriso_set_publisher(struct XorrisO *xorriso, char *name, int flag)
{
@ -6657,6 +6664,7 @@ int Xorriso_set_publisher(struct XorrisO *xorriso, char *name, int flag)
if(ret<=0)
return(ret);
iso_image_set_publisher_id(volume, name);
if(!(flag&1))
xorriso->volset_change_pending= 1;
Xorriso_process_msg_queues(xorriso,0);
@ -6667,6 +6675,31 @@ int Xorriso_set_publisher(struct XorrisO *xorriso, char *name, int flag)
}
/* @param flag bit0= do not mark image as changed */
int Xorriso_set_application_id(struct XorrisO *xorriso, char *name, int flag)
{
int ret;
IsoImage *volume;
if(xorriso->in_volset_handle == NULL)
return(2);
ret= Xorriso_get_volume(xorriso, &volume, 0);
if(ret<=0)
return(ret);
iso_image_set_application_id(volume, name);
if(!(flag&1))
xorriso->volset_change_pending= 1;
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"Application id: '%s'",
iso_image_get_application_id(volume));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
return(1);
}
#endif /* NIX */
/* @param flag bit0=prepare for a burn run */
int Xorriso_set_abort_severity(struct XorrisO *xorriso, int flag)
{

View File

@ -207,9 +207,15 @@ int Xorriso_burn_track(struct XorrisO *xorriso, off_t write_start_address,
int Xorriso_get_profile(struct XorrisO *xorriso, int *profile_number,
char profile_name[80], int flag);
#ifdef NIX
/* @param flag bit0= do not mark image as changed */
int Xorriso_set_publisher(struct XorrisO *xorriso, char *name, int flag);
/* @param flag bit0= do not mark image as changed */
int Xorriso_set_application_id(struct XorrisO *xorriso, char *name, int flag);
#endif /* NIX */
/* @param flag bit0= node_pt is a valid ISO object handle, ignore pathname
*/