Now option -auto_charset based on xattr "isofs.cs"

This commit is contained in:
Thomas Schmitt 2009-03-20 19:33:51 +00:00
parent d5cb4aa3d0
commit b4332a8387
6 changed files with 77 additions and 11 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1)
.TH XORRISO 1 "Mar 12, 2009"
.TH XORRISO 1 "Mar 20, 2009"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -657,6 +657,16 @@ image. This has eventually to be done before specifying -dev , -indev or
When loading the written image after -commit the setting of -out_charset
will be copied to -in_charset.
.TP
\fB\-auto_charset\fR "on"|"off"
Enable or disable recording of the output character set name in an xattr
attribute of the image root directory. If enabled then use an eventual
recorded character set name as input character set when reading an image.
.br
Note that the default output charset is the local character set of the
terminal where xorriso runs. Before attributing this one to the produced
ISO image, it is necessary to check whether the terminal properly displays
all intended filenames. Check especially the exotic national characters.
.TP
\fB\-acl\fR "on"|"off"
Enable or disable processing of ACLs.
If enabled, then xorriso will obtain ACLs from disk file objects,
@ -1035,8 +1045,8 @@ Since -getfacl and getfacl -R strip leading "/" from file paths, the setting of
\fB\-setfattr\fR [-]name value iso_rr_path [***]
Attach the given xattr pair of name and value to the given iso_rr_paths.
If the given name is prefixed by "-", then the pair with that name gets
removed from the xattr list. If name is "--remove-all" then the whole xattr
list of the given iso_rr_paths is deleted. In case of deletion, value must
removed from the xattr list. If name is "--remove-all" then all user namespace
xattr of the given iso_rr_paths get deleted. In case of deletion, value must
be an empty text.
.br
Only names from the user namespace are allowed. I.e. a name has to begin with
@ -1635,7 +1645,9 @@ Default is "old_rr" which uses Rock Ridge version 1.10. This implies also
"aaip_susp_1_10" allows AAIP to be written as inofficial extension of RRIP
rather than as official extension under SUSP-1.12.
.br
Default setting is "clear:deep_paths:long_paths:always_gmt".
Default setting is
.br
"clear:deep_paths:long_paths:always_gmt:old_rr".
.br
Note: The term "ISO file" means the plain ISO 9660 names wnd attributes
which get visible if the reader ignores Rock Ridge.

View File

@ -6382,6 +6382,10 @@ 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->do_aaip & (256 | 512)) == 0);
sprintf(line,"-auto_charset %s\n", (xorriso->do_aaip & 256 ? "on" : "off"));
if(!(is_default && no_defaults))
Xorriso_status_result(xorriso,filter,fp,flag&2);
is_default= ((xorriso->do_aaip & (1 | 4)) == 0);
sprintf(line,"-acl %s\n", (xorriso->do_aaip & 1 ? "on" : "off"));
@ -11762,6 +11766,22 @@ int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern,
}
/* Option -auto_charset "on"|"off" */
int Xorriso_option_auto_charset(struct XorrisO *xorriso, char *mode, int flag)
{
if(strcmp(mode, "off")==0)
xorriso->do_aaip&= ~(256 | 512);
else if(strcmp(mode, "on")==0)
xorriso->do_aaip|= (256 | 512);
else {
sprintf(xorriso->info_text, "-auto_charset: unknown mode '%s'", mode);
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
return(0);
}
return(1);
}
/* Option -backslash_codes */
int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode,
int flag)
@ -13939,6 +13959,8 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" conversion from and to media.",
" -in_charset name",
" Like -charset but only for conversion from media.",
" -auto_charset \"on\"|\"off\"",
" Enable writing and reading of character set name in image.",
" -out_charset name",
" Like -charset but only for conversion to media.",
" -local_charset name",
@ -16823,7 +16845,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
""
};
static char arg1_commands[][40]= {
"abort_on","acl","add_plainly","application_id","backslash_codes","blank",
"abort_on","acl","add_plainly","application_id","auto_charset",
"backslash_codes","blank",
"cd","cdi","cdx","charset","close","commit_eject","compliance",
"dev","dialog","disk_dev_ino","disk_pattern","dummy","eject",
"iso_rr_pattern","follow","format","fs","gid","grow_blindly",
@ -17015,6 +17038,10 @@ next_command:;
(*idx)+= 2;
ret= Xorriso_option_assert_volid(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"auto_charset")==0) {
(*idx)++;
ret= Xorriso_option_auto_charset(xorriso, arg1, 0);
} else if(strcmp(cmd,"backslash_codes")==0) {
(*idx)++;
ret= Xorriso_option_backslash_codes(xorriso, arg1, 0);

View File

@ -302,6 +302,9 @@ int Xorriso_option_as(struct XorrisO *xorriso, int argc, char **argv,
int Xorriso_option_assert_volid(struct XorrisO *xorriso, char *pattern,
char *severity, int flag);
/* Option -auto_charset "on"|"off" */
int Xorriso_option_auto_charset(struct XorrisO *xorriso, char *mode, int flag);
/* Option -backslash_codes */
int Xorriso_option_backslash_codes(struct XorrisO *xorriso, char *mode,
int flag);

View File

@ -104,7 +104,9 @@ struct XorrisO { /* the global context of xorriso */
int do_aaip; /* bit0= ACL in , bit1= ACL out , bit2= EA in , bit3= EA out
bit4= record dev,inode , bit5= check dev,inode
bit6= omit content check if dev,inode check is conclusive
bit7= omit dev check mit bit5
bit7= omit dev check with bit5
bit8= store output charset in xattr "isofs.cs"
bit9= allow to set input charset from xattr "isofs.cs"
*/
int relax_compliance; /* opaque bitfield to be set by xorrisoburn */

View File

@ -1 +1 @@
#define Xorriso_timestamP "2009.03.20.192910"
#define Xorriso_timestamP "2009.03.20.193334"

View File

@ -671,7 +671,7 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
ext= isoburn_ropt_noiso1999;
#ifdef isoburn_ropt_noaaip
if(!(xorriso->do_aaip & (1 | 4 | 16)))
if(!(xorriso->do_aaip & (1 | 4 | 32)))
ext|= isoburn_ropt_noaaip;
#endif
#ifdef isoburn_ropt_noacl
@ -681,11 +681,17 @@ int Xorriso_aquire_drive(struct XorrisO *xorriso, char *adr, int flag)
#ifdef isoburn_ropt_noea
if(!(xorriso->do_aaip & 4))
ext|= isoburn_ropt_noea;
#endif
#ifdef Libisofs_has_auto_input_charseT
/* >>> eventually allow iso_read_opts_auto_input_charset() */
#endif
isoburn_ropt_set_extensions(ropts, ext);
isoburn_ropt_set_default_perms(ropts, (uid_t) 0, (gid_t) 0, (mode_t) 0555);
isoburn_ropt_set_input_charset(ropts, xorriso->in_charset);
isoburn_ropt_set_auto_incharset(ropts, !!(xorriso->do_aaip & 512));
Xorriso_set_image_severities(xorriso, 1); /* No DEBUG messages */
Xorriso_pacifier_reset(xorriso, 0);
@ -1088,7 +1094,7 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
{
int ret, relax= 0, i, pacifier_speed= 0, data_lba;
int major, minor, micro;
char xorriso_id[256], *img_id, sfe[5*SfileadrL], *cpt;
char xorriso_id[256], *img_id, sfe[5*SfileadrL], *cpt, *out_cs;
struct isoburn_imgen_opts *sopts= NULL;
struct burn_drive_info *dinfo, *source_dinfo;
struct burn_drive *drive, *source_drive;
@ -1106,6 +1112,10 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
int profile_number;
char profile_name[80];
out_cs= xorriso->out_charset;
if(out_cs == NULL)
Xorriso_get_local_charset(xorriso, &out_cs, 0);
if(!(flag & 1)) {
ret= Xorriso_auto_format(xorriso, 0);
if(ret <=0 )
@ -1159,6 +1169,17 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
iso_image_set_publisher_id(image, xorriso->publisher);
}
if((xorriso->do_aaip & 256) && out_cs != NULL) {
static char *names = "isofs.cs";
size_t value_lengths[1];
value_lengths[0]= strlen(out_cs);
ret= Xorriso_setfattr(xorriso, NULL, "/",
(size_t) 1, &names, value_lengths, &out_cs, 2 | 8);
if(ret<=0)
goto ex;
}
/* Activate, adjust or discard boot image */
/* >>> ??? move down to libisoburn ? */
if(image!=NULL && !(flag&1)) {
@ -1293,12 +1314,12 @@ int Xorriso_write_session(struct XorrisO *xorriso, int flag)
}
isoburn_igopt_set_level(sopts, 3);
isoburn_igopt_set_extensions(sopts, 1 | ((!!xorriso->do_joliet)<<1) |
((!!(xorriso->do_aaip & (2 | 8 | 16))) << 5));
((!!(xorriso->do_aaip & (2 | 8 | 16 | 256))) << 5));
isoburn_igopt_set_relaxed(sopts, relax);
isoburn_igopt_set_sort_files(sopts, 1);
isoburn_igopt_set_over_mode(sopts, 0, 0, (mode_t) 0, (mode_t) 0);
isoburn_igopt_set_over_ugid(sopts, 0, 0, (uid_t) 0, (gid_t) 0);
isoburn_igopt_set_out_charset(sopts, xorriso->out_charset);
isoburn_igopt_set_out_charset(sopts, out_cs);
isoburn_igopt_set_fifo_size(sopts, xorriso->fs * 2048);
if(image!=NULL &&
@ -1677,6 +1698,7 @@ int Xorriso__read_pacifier(IsoImage *image, IsoFileSource *filesource)
xorriso= (struct XorrisO *) iso_image_get_attached_data(image);
if(xorriso==NULL)
return(1);
Xorriso_process_msg_queues(xorriso,0);
xorriso->pacifier_count++;
if(xorriso->pacifier_count%10)
return(1);