New option -paste_in
This commit is contained in:
@ -8834,7 +8834,8 @@ int Xorriso_option_cpx(struct XorrisO *xorriso, int argc, char **argv,
|
||||
goto problem_handler;
|
||||
}
|
||||
}
|
||||
ret= Xorriso_restore(xorriso, eff_origin, eff_dest, 16 | (!(flag&2)<<6));
|
||||
ret= Xorriso_restore(xorriso, eff_origin, eff_dest, (off_t) 0, (off_t) 0,
|
||||
16 | (!(flag&2)<<6));
|
||||
if(ret<=0 || xorriso->request_to_abort)
|
||||
goto problem_handler;
|
||||
if(ret==3 || (flag&1))
|
||||
@ -8866,18 +8867,26 @@ ex:;
|
||||
part_{partno}_of_{total_parts}_at_{offset}_with_{bytes}_of_{total_bytes}
|
||||
*/
|
||||
|
||||
/* Option -cut_out */
|
||||
/* Options -cut_out, -paste_in */
|
||||
/* @param flag bit0= -paste_in rather than cut_out
|
||||
*/
|
||||
int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
|
||||
char *start, char *count, char *iso_rr_path, int flag)
|
||||
{
|
||||
int ret;
|
||||
double num;
|
||||
off_t startbyte, bytecount;
|
||||
|
||||
char *cmd;
|
||||
|
||||
if(flag&1)
|
||||
cmd= "paste_in";
|
||||
else
|
||||
cmd= "cut_out";
|
||||
|
||||
num= Scanf_io_size(start, 0);
|
||||
if(num<0 || num > 1.0e18) { /* 10^18 = 10^3 ^ 6 < 2^10 ^ 6 = 2^60 */
|
||||
sprintf(xorriso->info_text,
|
||||
"-cut_out: startbyte address negative or much too large (%s)", start);
|
||||
"-%s: startbyte address negative or much too large (%s)", cmd, start);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
@ -8885,19 +8894,29 @@ int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
|
||||
num= Scanf_io_size(count, 0);
|
||||
if(num<=0 || num > 1.0e18) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-cut_out: bytecount zero, negative or much too large (%s)", count);
|
||||
"-%s: bytecount zero, negative or much too large (%s)", cmd, count);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
bytecount= num;
|
||||
sprintf(xorriso->info_text,
|
||||
"-cut_out from %s , byte %.f to %.f, and graft as %s",
|
||||
disk_path, (double) startbyte, (double) (startbyte+bytecount),
|
||||
iso_rr_path);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||
if(flag&1) {
|
||||
sprintf(xorriso->info_text, "-paste_in from %s to %s, byte %.f to %.f",
|
||||
disk_path, iso_rr_path,
|
||||
(double) startbyte, (double) (startbyte+bytecount));
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||
|
||||
ret= Xorriso_cut_out(xorriso, disk_path, startbyte, bytecount,
|
||||
iso_rr_path, 0);
|
||||
ret= Xorriso_paste_in(xorriso, disk_path, startbyte, bytecount,
|
||||
iso_rr_path, 0);
|
||||
} else {
|
||||
sprintf(xorriso->info_text,
|
||||
"-cut_out from %s , byte %.f to %.f, and graft as %s",
|
||||
disk_path, (double) startbyte, (double) (startbyte+bytecount),
|
||||
iso_rr_path);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "DEBUG", 0);
|
||||
|
||||
ret= Xorriso_cut_out(xorriso, disk_path, startbyte, bytecount,
|
||||
iso_rr_path, 0);
|
||||
}
|
||||
return(ret);
|
||||
}
|
||||
|
||||
@ -9778,6 +9797,8 @@ 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",
|
||||
@ -11645,7 +11666,7 @@ int Xorriso_count_args(struct XorrisO *xorriso, int argc, char **argv,
|
||||
""
|
||||
};
|
||||
static char arg4_commands[][40]= {
|
||||
"cut_out",
|
||||
"cut_out", "paste_in",
|
||||
""
|
||||
};
|
||||
static char argn_commands[][40]= {
|
||||
@ -12047,6 +12068,17 @@ next_command:;
|
||||
num2= 80;
|
||||
ret= Xorriso_option_page(xorriso, num1, num2, 0);
|
||||
|
||||
} else if(strcmp(cmd,"paste_in")==0) {
|
||||
(*idx)+= 4;
|
||||
if((*idx)>argc) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-paste_in: Not enough arguments. Needed are: disk_path start count so_rr_path");
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
ret= 0;
|
||||
} else
|
||||
ret= Xorriso_option_cut_out(xorriso, arg1, arg2,
|
||||
argv[(*idx)-2], argv[(*idx)-1], 1);
|
||||
|
||||
} else if(strcmp(cmd,"path-list")==0 || strcmp(cmd,"path_list")==0) {
|
||||
(*idx)++;
|
||||
ret= Xorriso_option_path_list(xorriso, arg1, 0);
|
||||
|
Reference in New Issue
Block a user