New option -cut_out
This commit is contained in:
@ -7159,7 +7159,7 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
|
||||
if(ret>0) {
|
||||
deleted= 1;
|
||||
ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path,
|
||||
2|(flag&4));
|
||||
(off_t) 0, (off_t) 0, 2|(flag&4));
|
||||
}
|
||||
sprintf(xorriso->info_text, "Deleted and re-added ");
|
||||
|
||||
@ -7173,7 +7173,7 @@ int Xorriso_update_interpreter(struct XorrisO *xorriso, void *boss_iter,
|
||||
/* iso_adr not existing, size, cannot open iso file, early eof of iso file
|
||||
content bytes differ */
|
||||
ret= Xorriso_graft_in(xorriso, boss_iter, disk_path, iso_rr_path,
|
||||
2|(flag&4));
|
||||
(off_t) 0, (off_t) 0, 2|(flag&4));
|
||||
sprintf(xorriso->info_text, "Added/overwrote ");
|
||||
|
||||
} else if(compare_result&(4|16|32|256|512|1024)) {
|
||||
@ -7288,7 +7288,7 @@ int Xorriso_option_add(struct XorrisO *xorriso, int argc, char **argv,
|
||||
goto problem_handler;
|
||||
strcpy(source, eff_path);
|
||||
|
||||
ret= Xorriso_graft_in(xorriso, NULL, source, target, 0);
|
||||
ret= Xorriso_graft_in(xorriso, NULL, source, target, (off_t)0, (off_t)0, 0);
|
||||
if(ret<=0 || xorriso->request_to_abort)
|
||||
goto problem_handler;
|
||||
sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n",
|
||||
@ -8052,7 +8052,8 @@ int Xorriso_option_cpri(struct XorrisO *xorriso, int argc, char **argv,
|
||||
goto problem_handler;
|
||||
}
|
||||
}
|
||||
ret= Xorriso_graft_in(xorriso, NULL, eff_origin, eff_dest, 0);
|
||||
ret= Xorriso_graft_in(xorriso, NULL, eff_origin, eff_dest,
|
||||
(off_t) 0, (off_t) 0, 0);
|
||||
if(ret<=0 || xorriso->request_to_abort)
|
||||
goto problem_handler;
|
||||
sprintf(xorriso->info_text, "Added to ISO image: %s '%s'='%s'\n",
|
||||
@ -8079,15 +8080,37 @@ ex:;
|
||||
|
||||
/* Option -cut_out */
|
||||
int Xorriso_option_cut_out(struct XorrisO *xorriso, char *disk_path,
|
||||
off_t startbyte, off_t bytecount, char *iso_rr_path, int flag)
|
||||
char *start, char *count, char *iso_rr_path, int flag)
|
||||
{
|
||||
int ret;
|
||||
double num;
|
||||
off_t startbyte, bytecount;
|
||||
|
||||
fprintf(stderr,
|
||||
">>> LIBISOFS : would cut out from %s , byte %.f to %.f, and graft as %s",
|
||||
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);
|
||||
Xorriso_msgs_submit(xorriso, 0, xorriso->info_text, 0, "FAILURE", 0);
|
||||
return(0);
|
||||
}
|
||||
startbyte= num;
|
||||
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);
|
||||
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);
|
||||
|
||||
return(1);
|
||||
ret= Xorriso_cut_out(xorriso, disk_path, startbyte, bytecount,
|
||||
iso_rr_path, 0);
|
||||
return(ret);
|
||||
}
|
||||
|
||||
|
||||
@ -10258,8 +10281,7 @@ return:
|
||||
{
|
||||
int ret, was_dashed, end_ret;
|
||||
int num1, num2;
|
||||
double d1, d2;
|
||||
char *cmd, *arg1, *arg2, *arg4;
|
||||
char *cmd, *arg1, *arg2;
|
||||
|
||||
if(xorriso==NULL)
|
||||
return(0);
|
||||
@ -10386,17 +10408,15 @@ next_command:;
|
||||
ret= Xorriso_option_cpri(xorriso, argc, argv, idx, 0);
|
||||
|
||||
} else if(strcmp(cmd,"cut_out")==0) {
|
||||
(*idx)+= 2;
|
||||
d1= d2= -1;
|
||||
sscanf(arg2,"%lf", &d1);
|
||||
if((*idx)<argc)
|
||||
sscanf(argv[*idx],"%lf", &d2);
|
||||
if((*idx)+1<argc)
|
||||
arg4= argv[(*idx)+1];
|
||||
else
|
||||
arg4= "";
|
||||
(*idx)+= 2;
|
||||
ret= Xorriso_option_cut_out(xorriso, arg1, (off_t) d1, (off_t) d2, arg4, 0);
|
||||
(*idx)+= 4;
|
||||
if((*idx)>argc) {
|
||||
sprintf(xorriso->info_text,
|
||||
"-cut_out: 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], 0);
|
||||
|
||||
} else if(strcmp(cmd,"dev")==0) {
|
||||
(*idx)++;
|
||||
|
Reference in New Issue
Block a user