New options -extract and -extract_single
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user