New option -publisher

This commit is contained in:
Thomas Schmitt 2008-02-21 13:01:34 +00:00
parent aaeb1204b7
commit 43ea3bdef2
6 changed files with 79 additions and 6 deletions

View File

@ -2673,6 +2673,7 @@ int Xorriso_new(struct XorrisO ** xorriso,char *progname, int flag)
m->global_uid= 0;
strcpy(m->volid, "ISOIMAGE");
m->loaded_volid[0]= 0;
m->publisher[0]= 0;
m->volid_default= 1;
m->do_global_gid= 0;
m->global_gid= 0;
@ -3869,6 +3870,11 @@ int Xorriso_status(struct XorrisO *xorriso, char *filter, FILE *fp, int flag)
Xorriso_status_result(xorriso,filter,fp,flag&2);
}
is_default= (xorriso->publisher[0]==0);
sprintf(line,"-publisher %s\n",Text_shellsafe(xorriso->publisher,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))
@ -6438,7 +6444,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
int argc, char **argv, int flag)
{
int ret, i, k, was_path= 0, was_other_option= 0, mem_graft_points;
int do_print_size= 0;
int do_print_size= 0, idx_offset= 0;
char sfe[5*SfileadrL], adr[SfileadrL+8], ra_text[80], pathspec[2*SfileadrL];
char *ept, *add_pt, eff_path[SfileadrL];
@ -6452,7 +6458,7 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
""
};
static char ignored_arg1_options[][41]= {
"-A", "-biblio", "-check-session", "-P", "-publisher", "-p", "-root",
"-A", "-biblio", "-check-session", "-p", "-root",
"-old-root", "-sysid", "-table-name",
""
};
@ -6560,18 +6566,20 @@ int Xorriso_genisofs(struct XorrisO *xorriso, char *whom,
sprintf(xorriso->info_text, "-as %s: %s",
whom, Text_shellsafe(argv[i], sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
idx_offset= 0;
for(k=0;ignored_arg0_options[k][0]!=0;k++)
if(strcmp(argv[i],ignored_arg0_options[k])==0)
goto no_volunteer;
for(k=0;ignored_arg1_options[k][0]!=0;k++)
if(strcmp(argv[i],ignored_arg0_options[k])==0) {
if(strcmp(argv[i],ignored_arg1_options[k])==0) {
i++;
idx_offset= -1;
goto no_volunteer;
}
if(0) {
no_volunteer:;
sprintf(xorriso->info_text, "-as %s: Ignored option %s",
whom, Text_shellsafe(argv[i], sfe, 0));
whom, Text_shellsafe(argv[i+idx_offset], sfe, 0));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "NOTE", 0);
continue;
}
@ -6618,6 +6626,13 @@ not_enough_args:;
ret= Xorriso_option_volid(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-P")==0 || strcmp(argv[i], "-publisher")==0) {
if(i+1>=argc)
goto not_enough_args;
i++;
ret= Xorriso_option_publisher(xorriso, argv[i], 0);
if(ret<=0)
goto ex;
} else if(strcmp(argv[i], "-v")==0 || strcmp(argv[i], "-quiet")==0) {
/* was already handled in first argument scan */;
@ -8023,7 +8038,9 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -format \"full\"",
" Format DVD-RW to overwriteable state or de-ice DVD+RW.",
" -volid volume_id",
" Specifies the volume ID text.",
" Specifies the volume ID text. (32 chars out of [A-Z0-9_])",
" -publisher name",
" Specifies the publisher name. (128 chars)",
" -joliet \"on\"|\"off\"",
" Generate Joliet info additional to Rock Ridge info.",
" -bootimage \"any\"|\"isolinux\" \"discard\"|\"keep\"|\"patch\"",
@ -8937,6 +8954,27 @@ int Xorriso_option_prompt(struct XorrisO *xorriso, char *text, int flag)
}
/* Option -publisher */
int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag)
{
int ret;
if(strlen(name)>=sizeof(xorriso->publisher)) {
sprintf(xorriso->info_text,
"Name too long with option -publisher (%d > %d)",
(int) strlen(name), (int) sizeof(xorriso->publisher)-1);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 0);
return(0);
}
ret= Xorriso_set_publisher(xorriso, name, 0);
if(ret<=0)
return(ret);
if(Sfile_str(xorriso->publisher,name,0)<=0)
return(-1);
return(1);
}
/* Option -pwd alias -pwdi */
int Xorriso_option_pwdi(struct XorrisO *xorriso, int flag)
{
@ -9674,6 +9712,10 @@ next_command:;
(*idx)++;
ret= Xorriso_option_prog(xorriso, arg1, 0);
} else if(strcmp(cmd,"publisher")==0) {
(*idx)++;
Xorriso_option_publisher(xorriso, arg1, 0);
} else if(strcmp(cmd,"pwd")==0 || strcmp(cmd,"pwdi")==0) {
Xorriso_option_pwdi(xorriso, 0);

View File

@ -362,6 +362,9 @@ int Xorriso_option_prog(struct XorrisO *xorriso, char *name, int flag);
/* Option -prog_help */
int Xorriso_option_prog_help(struct XorrisO *xorriso, char *name, int flag);
/* Option -publisher */
int Xorriso_option_publisher(struct XorrisO *xorriso, char *name, int flag);
/* Option -pwd alias -pwdi */
int Xorriso_option_pwdi(struct XorrisO *xorriso, int flag);

View File

@ -101,6 +101,8 @@ struct XorrisO { /* the global context of xorriso */
int volid_default;
char loaded_volid[33];
char publisher[129];
/* >>> put libburn/isoburn aspects here */
char indev[SfileadrL];

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.02.20.234726"
#define Xorriso_timestamP "2008.02.21.130047"

View File

@ -3838,6 +3838,28 @@ int Xorriso_get_volid(struct XorrisO *xorriso, char volid[33], int flag)
}
/* @param flag bit0= do not mark image as changed */
int Xorriso_set_publisher(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_publisher_id(volume, name);
if(!(flag&1))
xorriso->volset_change_pending= 1;
Xorriso_process_msg_queues(xorriso,0);
sprintf(xorriso->info_text,"Publisher: '%s'",
iso_image_get_publisher_id(volume));
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
return(1);
}
/* @param flag bit0=prepare for a burn run */
int Xorriso_set_abort_severity(struct XorrisO *xorriso, int flag)
{

View File

@ -162,5 +162,9 @@ int Xorriso_burn_track(struct XorrisO *xorriso, char *track_source, int flag);
int Xorriso_get_profile(struct XorrisO *xorriso, int *profile_number,
char profile_name[80], int flag);
/* @param flag bit0= do not mark image as changed */
int Xorriso_set_publisher(struct XorrisO *xorriso, char *name, int flag);
#endif /* Xorrisoburn_includeD */