New options -extract and -extract_single

This commit is contained in:
Thomas Schmitt 2008-06-14 10:47:19 +00:00
parent 26b3dcb1f5
commit 0d2e79ece8
4 changed files with 101 additions and 24 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 "Jun, 13, 2008"
.TH XORRISO 1 "Jun, 14, 2008"
.\" Please adjust this date whenever revising the manpage.
.\"
.\" Some roff macros, for reference:
@ -31,6 +31,8 @@ filesystems into Rock Ridge enhanced ISO 9660 filesystems and allows
session-wise manipulation of such filesystems. It can load the management
information of existing ISO images and it writes the session results to
optical media or to filesystem objects.
.br
Vice versa xorriso is able to restore file objects from ISO 9660 filesystems.
.PP
A special property of xorriso is that it needs neither an external ISO 9660
formatter program nor an external burn program for CD or DVD but rather
@ -54,7 +56,7 @@ filesystem objects.
Can write result as add-on session to appendable multi-session media,
to overwriteable media, to regular files, and to block devices.
.br
Can copy files from ISO image to disk filesystem.
Can restore files from ISO image to disk filesystem (see osirrox).
.br
Scans for optical drives, blanks re-useable optical media.
.br
@ -1641,18 +1643,6 @@ of -cut_out part files.
.br
With option "concat_split_off" such directories are
handled like any other ISO image directory.
.br
Note that some restore operations are inverse mappings of data manipulation
commands which have the same parameters. I.e. the disk_path stays the first
argument although the operation copies data from ISO image to disk.
.br
Other operations, like -cpx, have the iso_rr_paths first and the the disk_path
as last argument.
.TP
\fB\-paste_in\fR disk_path byte_offset byte_count iso_rr_path
Extract the content of a ISO data file iso_rr_path and write it into a data
file on disk beginning at the byte_offset. Write at most byte_count bytes.
This is the inverse mapping of option -cut_out.
.TP
\fB\-cpx\fR iso_rr_path [***] disk_path
Extract single leaf file objects from the ISO image and store them under
@ -1688,6 +1678,24 @@ by file objects from the ISO image.
\fB\-cp_rax\fR iso_rr_path [***] disk_path
Like -cp_rx but restoring mtime, atime as in ISO image and trying to set
ownership and group as in ISO image.
.PP
The following restore operations are inverse mappings of data manipulation
commands which have the same parameters. I.e. the disk_path stays the first
argument although the operation copies data from ISO image to disk.
.TP
\fB\-extract\fR disk_path iso_rr_path
Restore the file objects underneath iso_rr_path to their corresponding
addresses underneath disk_path. This is the inverse mapping of options -map
or -update_r with the same arguments.
.TP
\fB\-extract_single\fR disk_path iso_rr_path
Like -extract, but if iso_rr_path is a directory then its sub tree gets not
restored.
.TP
\fB\-paste_in\fR disk_path byte_offset byte_count iso_rr_path
Read the content of a ISO data file iso_rr_path and write it into a data
file on disk beginning at the byte_offset. Write at most byte_count bytes.
This is the inverse mapping of option -cut_out with the same arguments.
.TP
.B Command compatibility emulations:
.PP

View File

@ -8835,7 +8835,7 @@ int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv,
}
}
ret= Xorriso_restore(xorriso, eff_origin, eff_dest, (off_t) 0, (off_t) 0,
16 | (!(flag&2)<<6));
16 | ((!(flag&2))<<6));
if(ret<=0 || xorriso->request_to_abort)
goto problem_handler;
if(ret==3 || (flag&1))
@ -9217,6 +9217,52 @@ int Xorriso_option_error_behavior(struct XorrisO *xorriso,
}
/* Option -extract , -extract_single */
/* @param flag bit0=do not report the restored item
bit1=do not reset pacifier, no final pacifier message
bit5= -extract_single: eventually do not insert directory tree
*/
int Xorriso_option_extract(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag)
{
int ret;
char eff_origin[SfileadrL], eff_dest[SfileadrL], *ipth;
if(!(flag&2))
Xorriso_pacifier_reset(xorriso, 0);
ipth= iso_path;
if(ipth[0]==0)
ipth= disk_path;
if(disk_path[0]==0) {
sprintf(xorriso->info_text, "-extract: Empty disk_path given");
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "SORRY", 1);
return(0);
}
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_dest,
2|4);
if(ret<=0)
return(ret);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, ipth, eff_origin, 2);
if(ret<=0)
return(ret);
ret= Xorriso_restore(xorriso, eff_origin, eff_dest,
(off_t) 0, (off_t) 0, (flag&32));
if(!(flag&2))
Xorriso_pacifier_callback(xorriso, "files restored",xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
if(ret<=0)
return(ret);
if(!(flag&1)) {
sprintf(xorriso->info_text, "Extracted from ISO image: %s '%s'='%s'\n",
(ret>1 ? "directory" : "file"), eff_origin, eff_dest);
Xorriso_info(xorriso,0);
}
return(1);
}
/* Option -follow */
int Xorriso_option_follow(struct XorrisO *xorriso, char *mode, int flag)
{
@ -9797,8 +9843,6 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" By default \"off\" the inverse operation of xorriso from ISO",
" image to disk filesystem is disabled. \"on\" allows xorriso",
" to create, overwrite, delete files in the disk filesystem.",
" -paste_in disk_path byte_offset byte_count iso_rr_path",
" Copy ISO file content into a byte interval of a disk file.",
" -cpx iso_rr_path [***] disk_path",
" Copy leaf file objects from ISO image to disk filesystem.",
" -cpax iso_rr_path [***] disk_path",
@ -9807,6 +9851,15 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" Copy directory trees from ISO image to disk filesystem.",
" -cp_rax iso_rr_path [***] disk_path",
" Like -cp_rx but trying to restore timestamps and ownership.",
"The following restore options get the same arguments as their counterparts",
"which put files into ISO images. Thus first disk_path and then iso_rr_path:",
" -extract disk_path iso_rr_path",
" Copy tree under iso_rr_path onto disk address disk_path.",
" This avoids the pitfalls of cp -r addressing rules.",
" -extract_single disk_path iso_rr_path",
" Like -extract but with directory do not insert its sub tree.",
" -paste_in disk_path byte_offset byte_count iso_rr_path",
" Copy ISO file content into a byte interval of a disk file.",
"",
"Compatibility emulation (argument list may be ended by --):",
" -as mkisofs [-help|-o|-R|-J|-V|-P|-f|-m|-graft-points|-path-list|pathspecs]",
@ -11661,7 +11714,8 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
};
static char arg2_commands[][40]= {
"alter_date","alter_date_r","boot_image","compare","compare_r",
"errfile_log","error_behavior","load","logfile",
"errfile_log","error_behavior","extract","extract_single",
"load","logfile",
"map","map_single","page","return_with","update","update_r",
""
};
@ -11930,9 +11984,13 @@ next_command:;
(*idx)+= 2;
ret= Xorriso_option_error_behavior(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"iso_rr_pattern")==0) {
(*idx)++;
ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0);
} else if(strcmp(cmd,"extract")==0) {
(*idx)+= 2;
ret= Xorriso_option_extract(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"extract_single")==0) {
(*idx)+= 2;
ret= Xorriso_option_extract(xorriso, arg1, arg2, 32);
} else if(strcmp(cmd,"follow")==0) {
(*idx)++;
@ -11968,6 +12026,10 @@ next_command:;
(*idx)++;
ret= Xorriso_option_dev(xorriso, arg1, 1);
} else if(strcmp(cmd,"iso_rr_pattern")==0) {
(*idx)++;
ret= Xorriso_option_iso_rr_pattern(xorriso, arg1, 0);
} else if(strcmp(cmd,"joliet")==0) {
(*idx)++;
ret= Xorriso_option_joliet(xorriso, arg1, 0);

View File

@ -358,16 +358,23 @@ Enhancements towards previous stable version xorriso-0.1.6.pl00:
<DT><H3>Development snapshot, version 0.1.9 :</H3></DT>
<DD>Bug fixes towards xorriso-0.1.8.pl00:
<UL>
<LI>- none yet -</LI>
<LI>
-chmod unintentionally performed o-x as first operation
</LI>
<!--
<LI>- none yet -</LI>
-->
</UL>
</DD>
<DD>Enhancements towards stable version 0.1.8.pl00:
<UL>
<LI>
New options -cpax, -cp_rx, -cp_rax to restore files and trees from ISO to disk
</LI>
<LI>- none yet -</LI>
<LI>New option -paste_in to copy ISO files into parts of disk files</LI>
<LI>New option -extract restores with arguments of -map or -update_r</LI>
<!--
<LI>- none yet -</LI>
-->
</UL>
</DD>

View File

@ -1 +1 @@
#define Xorriso_timestamP "2008.06.13.151630"
#define Xorriso_timestamP "2008.06.14.104745"