New options -map and -map_single

This commit is contained in:
2008-05-15 15:00:39 +00:00
parent e2e793ed4b
commit cee91f4859
6 changed files with 130 additions and 60 deletions

View File

@ -9098,18 +9098,23 @@ int Xorriso_option_help(struct XorrisO *xorriso, int flag)
" -path_list disk_path",
" Like -add but read the pathspecs from file disk_path.",
"",
" -map disk_path iso_rr_path",
" Insert disk file object at the given iso_rr_path.",
" -map_single disk_path iso_rr_path",
" Like -map but with directory do not insert its sub tree.",
" -update disk_path iso_rr_path",
" Compare both file objects and do what is necessary to make",
" iso_rr_path a matching copy of disk_path.",
" iso_rr_path a matching copy of disk_path.",
" -update_r disk_path iso_rr_path",
" Like -update but affecting all files below directories.",
" -cpr disk_path [***] iso_rr_path",
" Insert the given files or directory trees from filesystem",
" into the ISO image.",
" -cut_out disk_path byte_offset byte_count iso_rr_path",
" Map a byte interval of a regular disk file into a regular",
" file in the ISO image.",
"",
" -cpr disk_path [***] iso_rr_path",
" Insert the given files or directory trees from filesystem",
" into the ISO image, according to the rules of cp -r.",
"",
" -rm iso_rr_path [***]",
" Delete the given files from the ISO image.",
" -rm_r iso_rr_path [***]",
@ -9688,6 +9693,45 @@ ex:;
}
/* Option -map , -map_single */
/* @param flag bit0=do not report the added item
bit1=do not reset pacifier, no final pacifier message
bit5=eventually do not insert directory tree
*/
int Xorriso_option_map(struct XorrisO *xorriso, char *disk_path,
char *iso_path, int flag)
{
int ret;
char eff_origin[SfileadrL], eff_dest[SfileadrL];
if(!(flag&2))
Xorriso_pacifier_reset(xorriso, 0);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdx, disk_path, eff_origin,
2|4);
if(ret<=0)
return(ret);
ret= Xorriso_normalize_img_path(xorriso, xorriso->wdi, iso_path, eff_dest,
2);
if(ret<=0)
return(ret);
ret= Xorriso_graft_in(xorriso, NULL, eff_origin, eff_dest,
(off_t) 0, (off_t) 0, 2|(flag&32));
if(!(flag&2))
Xorriso_pacifier_callback(xorriso, "files added", xorriso->pacifier_count,
xorriso->pacifier_total, "", 1);
if(ret<=0)
return(ret);
if(!(flag&1)) {
sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n",
(ret>1 ? "directory" : "file"), eff_dest, eff_origin);
Xorriso_info(xorriso,0);
}
return(1);
}
/* Option -mark */
int Xorriso_option_mark(struct XorrisO *xorriso, char *mark, int flag)
{
@ -11239,6 +11283,14 @@ next_command:;
} else if(strcmp(cmd,"lsx")==0 || strcmp(cmd,"lslx")==0) {
ret= Xorriso_option_lsx(xorriso, argc, argv, idx, (cmd[2]=='l'));
} else if(strcmp(cmd,"map")==0) {
(*idx)+= 2;
ret= Xorriso_option_map(xorriso, arg1, arg2, 0);
} else if(strcmp(cmd,"map_single")==0) {
(*idx)+= 2;
ret= Xorriso_option_map(xorriso, arg1, arg2, 32);
} else if(strcmp(cmd,"mark")==0) {
(*idx)++;
ret= Xorriso_option_mark(xorriso, arg1, 0);